mirror of https://git.48k.eu/ogclient
Change browser behaviour
We have observed that the browser did not show changes. This happens because the ogClient opens the browser at the beginning and forget about it. To show correctly the changes ogClient had to restart the browser every time the menu html changes. This commit changes the behaviour to restart the browser when the menu html has changed.more_events
parent
a32bf4071e
commit
f0c550ee2a
3
main.py
3
main.py
|
@ -26,9 +26,6 @@ def main():
|
|||
url = ogconfig.get_value_section('opengnsys', 'url')
|
||||
mode = ogconfig.get_value_section('opengnsys', 'mode')
|
||||
|
||||
if mode == 'linux':
|
||||
proc = subprocess.Popen(["browser", "-qws", url])
|
||||
|
||||
client = ogClient(ip, int(port), mode)
|
||||
client.connect()
|
||||
client.run()
|
||||
|
|
|
@ -13,6 +13,19 @@ from src.ogConfig import *
|
|||
OG_SHELL = '/bin/bash'
|
||||
|
||||
class OgLinuxOperations:
|
||||
|
||||
_ogconfig = ogConfig()
|
||||
_config_path = f'{ogConfig.OG_PATH}ogclient/cfg/ogclient.cfg'
|
||||
_ogconfig.parser_file(_config_path)
|
||||
_url = _ogconfig.get_value_section('opengnsys', 'url')
|
||||
|
||||
def _restartBrowser(self):
|
||||
try:
|
||||
proc = subprocess.call(["pkill", "-9", "browser"])
|
||||
proc = subprocess.Popen(["browser", "-qws", OgLinuxOperations._url])
|
||||
except:
|
||||
raise ValueError('Error: cannot restart browser')
|
||||
|
||||
def parseGetConf(self, out):
|
||||
parsed = {'serial_number': '',
|
||||
'disk_setup': '',
|
||||
|
@ -66,6 +79,8 @@ class OgLinuxOperations:
|
|||
except:
|
||||
raise ValueError('Error: Incorrect command value')
|
||||
|
||||
self._restartBrowser()
|
||||
|
||||
return output.decode('utf-8')
|
||||
|
||||
def session(self, request, ogRest):
|
||||
|
@ -142,6 +157,8 @@ class OgLinuxOperations:
|
|||
|
||||
cmd_get_conf = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration'
|
||||
result = subprocess.check_output([cmd_get_conf], shell=True)
|
||||
self._restartBrowser()
|
||||
|
||||
return self.parseGetConf(result.decode('utf-8'))
|
||||
|
||||
def image_restore(self, request, ogRest):
|
||||
|
@ -164,6 +181,8 @@ class OgLinuxOperations:
|
|||
except:
|
||||
raise ValueError('Error: Incorrect command value')
|
||||
|
||||
self._restartBrowser()
|
||||
|
||||
return output.decode('utf-8')
|
||||
|
||||
def image_create(self, path, request, ogRest):
|
||||
|
@ -210,4 +229,6 @@ class OgLinuxOperations:
|
|||
except:
|
||||
raise ValueError('Error: Incorrect command value')
|
||||
|
||||
self._restartBrowser()
|
||||
|
||||
return self.parseGetConf(output.decode('utf-8'))
|
||||
|
|
Loading…
Reference in New Issue