source: ogClient-Git/src/linux/ogOperations.py @ 2d3d31b

Last change on this file since 2d3d31b was 2d3d31b, checked in by Jose M. Guisado <jguisado@…>, 3 years ago

#1065 src: add linux mode

ogClient can run in "linux" mode. In addition to live or virtual.
Serves as a substitute to the legacy ogagent, which has not received any
updates since 2020/07/23.

Linux mode initially supports remote reboot and poweroff. Requires
updated ogServer with the Linux ogclient state.

ogClient can be set up to run in linux mode by specifying it in
ogclient.json:

{

"opengnsys": {

"ip": "192.168.56.10",
"port": 8889,
"log": "DEBUG",
"mode": "linux",

...

}

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#
2# Copyright (C) 2021 Soleta Networks <info@soleta.eu>
3#
4# This program is free software: you can redistribute it and/or modify it under
5# the terms of the GNU Affero General Public License as published by the
6# Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8
9import os
10from src.ogRest import ThreadState
11
12
13class OgLinuxOperations:
14
15    def _restartBrowser(self, url):
16        raise NotImplementedError
17
18    def poweroff(self):
19        os.system('systemctl poweroff')
20
21    def reboot(self):
22        os.system('systemctl reboot')
23
24    def shellrun(self, request, ogRest):
25        raise NotImplementedError
26
27    def session(self, request, ogRest):
28        raise NotImplementedError
29
30    def hardware(self, path, ogRest):
31        raise NotImplementedError
32
33    def setup(self, request, ogRest):
34        raise NotImplementedError
35
36    def image_restore(self, request, ogRest):
37        raise NotImplementedError
38
39    def image_create(self, path, request, ogRest):
40        raise NotImplementedError
41
42    def refresh(self, ogRest):
43        return {"status": "LINUX"}
44
45    def probe(self, ogRest):
46        return {'status': 'LINUX' if ogRest.state != ThreadState.BUSY else 'BSY'}
Note: See TracBrowser for help on using the repository browser.