mirror of https://git.48k.eu/ogclient
Add realtime log menu
We observed that with the new ogClient the ogLive did not show the realtime log menu*. This commit changes the ogClient to launch the browser and show the realtime log menu when some commands are executed. * The realtime log menu is a menu that shows current status and info about the command that the ogLive is executing.more_events
parent
b576836e43
commit
0807ec76ed
|
|
@ -1,6 +1,7 @@
|
||||||
[opengnsys]
|
[opengnsys]
|
||||||
ip=127.0.0.1
|
ip=127.0.0.1
|
||||||
url=https://127.0.0.1/opengnsys/varios/menubrowser.php
|
url=https://127.0.0.1/opengnsys/varios/menubrowser.php
|
||||||
|
url_log=http://localhost/cgi-bin/httpd-log.sh
|
||||||
port=8889
|
port=8889
|
||||||
# Log Level, if ommited, will be set to INFO
|
# Log Level, if ommited, will be set to INFO
|
||||||
log=DEBUG
|
log=DEBUG
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@ class OgLinuxOperations:
|
||||||
_config_path = f'{ogConfig.OG_PATH}ogclient/cfg/ogclient.cfg'
|
_config_path = f'{ogConfig.OG_PATH}ogclient/cfg/ogclient.cfg'
|
||||||
_ogconfig.parser_file(_config_path)
|
_ogconfig.parser_file(_config_path)
|
||||||
_url = _ogconfig.get_value_section('opengnsys', 'url')
|
_url = _ogconfig.get_value_section('opengnsys', 'url')
|
||||||
|
_url_log = _ogconfig.get_value_section('opengnsys', 'url_log')
|
||||||
|
|
||||||
def _restartBrowser(self):
|
def _restartBrowser(self, url):
|
||||||
try:
|
try:
|
||||||
proc = subprocess.call(["pkill", "-9", "browser"])
|
proc = subprocess.call(["pkill", "-9", "browser"])
|
||||||
proc = subprocess.Popen(["browser", "-qws", OgLinuxOperations._url])
|
proc = subprocess.Popen(["browser", "-qws", url])
|
||||||
except:
|
except:
|
||||||
raise ValueError('Error: cannot restart browser')
|
raise ValueError('Error: cannot restart browser')
|
||||||
|
|
||||||
|
|
@ -70,6 +71,9 @@ class OgLinuxOperations:
|
||||||
def execCMD(self, request, ogRest):
|
def execCMD(self, request, ogRest):
|
||||||
cmd = request.getrun()
|
cmd = request.getrun()
|
||||||
cmds = cmd.split(";|\n\r")
|
cmds = cmd.split(";|\n\r")
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ogRest.proc = subprocess.Popen(cmds,
|
ogRest.proc = subprocess.Popen(cmds,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
@ -81,7 +85,7 @@ class OgLinuxOperations:
|
||||||
|
|
||||||
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
||||||
result = subprocess.check_output([cmd_get_conf], shell=True)
|
result = subprocess.check_output([cmd_get_conf], shell=True)
|
||||||
self._restartBrowser()
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return output.decode('utf-8')
|
return output.decode('utf-8')
|
||||||
|
|
||||||
|
|
@ -105,6 +109,8 @@ class OgLinuxOperations:
|
||||||
disk = request.getDisk()
|
disk = request.getDisk()
|
||||||
partition = request.getPartition()
|
partition = request.getPartition()
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \
|
cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \
|
||||||
f'{partition} {path}'
|
f'{partition} {path}'
|
||||||
|
|
@ -117,12 +123,16 @@ class OgLinuxOperations:
|
||||||
except:
|
except:
|
||||||
raise ValueError('Error: Incorrect command value')
|
raise ValueError('Error: Incorrect command value')
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
software = ''
|
software = ''
|
||||||
with open(path, 'r') as f:
|
with open(path, 'r') as f:
|
||||||
software = f.read()
|
software = f.read()
|
||||||
return software
|
return software
|
||||||
|
|
||||||
def hardware(self, path, ogRest):
|
def hardware(self, path, ogRest):
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioHardware {path}'
|
cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioHardware {path}'
|
||||||
ogRest.proc = subprocess.Popen([cmd],
|
ogRest.proc = subprocess.Popen([cmd],
|
||||||
|
|
@ -133,6 +143,8 @@ class OgLinuxOperations:
|
||||||
except:
|
except:
|
||||||
raise ValueError('Error: Incorrect command value')
|
raise ValueError('Error: Incorrect command value')
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return output.decode('utf-8')
|
return output.decode('utf-8')
|
||||||
|
|
||||||
def setup(self, request, ogRest):
|
def setup(self, request, ogRest):
|
||||||
|
|
@ -162,7 +174,7 @@ class OgLinuxOperations:
|
||||||
|
|
||||||
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
||||||
result = subprocess.check_output([cmd_get_conf], shell=True)
|
result = subprocess.check_output([cmd_get_conf], shell=True)
|
||||||
self._restartBrowser()
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return self.parseGetConf(result.decode('utf-8'))
|
return self.parseGetConf(result.decode('utf-8'))
|
||||||
|
|
||||||
|
|
@ -177,6 +189,8 @@ class OgLinuxOperations:
|
||||||
cmd = f'{ogConfig.OG_PATH}interfaceAdm/RestaurarImagen {disk} {partition} ' \
|
cmd = f'{ogConfig.OG_PATH}interfaceAdm/RestaurarImagen {disk} {partition} ' \
|
||||||
f'{name} {repo} {ctype}'
|
f'{name} {repo} {ctype}'
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ogRest.proc = subprocess.Popen([cmd],
|
ogRest.proc = subprocess.Popen([cmd],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
@ -188,7 +202,7 @@ class OgLinuxOperations:
|
||||||
|
|
||||||
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
||||||
result = subprocess.check_output([cmd_get_conf], shell=True)
|
result = subprocess.check_output([cmd_get_conf], shell=True)
|
||||||
self._restartBrowser()
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return output.decode('utf-8')
|
return output.decode('utf-8')
|
||||||
|
|
||||||
|
|
@ -202,6 +216,8 @@ class OgLinuxOperations:
|
||||||
cmd_create_image = f'{ogConfig.OG_PATH}interfaceAdm/CrearImagen {disk} ' \
|
cmd_create_image = f'{ogConfig.OG_PATH}interfaceAdm/CrearImagen {disk} ' \
|
||||||
f'{partition} {name} {repo}'
|
f'{partition} {name} {repo}'
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ogRest.proc = subprocess.Popen([cmd_software],
|
ogRest.proc = subprocess.Popen([cmd_software],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
@ -223,9 +239,13 @@ class OgLinuxOperations:
|
||||||
except:
|
except:
|
||||||
raise ValueError('Error: Incorrect command value')
|
raise ValueError('Error: Incorrect command value')
|
||||||
|
|
||||||
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return output.decode('utf-8')
|
return output.decode('utf-8')
|
||||||
|
|
||||||
def refresh(self, ogRest):
|
def refresh(self, ogRest):
|
||||||
|
self._restartBrowser(OgLinuxOperations._url_log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
cmd = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
||||||
ogRest.proc = subprocess.Popen([cmd],
|
ogRest.proc = subprocess.Popen([cmd],
|
||||||
|
|
@ -236,6 +256,6 @@ class OgLinuxOperations:
|
||||||
except:
|
except:
|
||||||
raise ValueError('Error: Incorrect command value')
|
raise ValueError('Error: Incorrect command value')
|
||||||
|
|
||||||
self._restartBrowser()
|
self._restartBrowser(OgLinuxOperations._url)
|
||||||
|
|
||||||
return self.parseGetConf(output.decode('utf-8'))
|
return self.parseGetConf(output.decode('utf-8'))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue