live: clear ogbrowser logs before image_restore

Clears content of blue text areas in the real time log view before
executing a restore image operation.

Adds private function _ogbrowser_clear_logs, this function writes to a
couple of text files present in the ogLive environment.
The contents of this file are printed out to the blue text areas
in the "real time log" view.
more_events
Jose M. Guisado 2022-12-01 15:22:58 +01:00
parent 699a6c242a
commit 70f1d0d71d
1 changed files with 7 additions and 1 deletions

View File

@ -181,6 +181,12 @@ class OgLiveOperations:
proc_lzop.stdout.close()
proc_pc.communicate()
def _ogbrowser_clear_logs(self):
logfiles = ['/tmp/command.log', '/tmp/session.log']
for logfile in logfiles:
with open(logfile, 'wb', 0) as f:
f.truncate(0)
def poweroff(self):
logging.info('Powering off client')
if os.path.exists('/scripts/oginit'):
@ -329,9 +335,9 @@ class OgLiveOperations:
ctype = request.getType()
profile = request.getProfile()
cid = request.getId()
partdev = get_partition_device(int(disk), int(partition))
self._ogbrowser_clear_logs()
self._restartBrowser(self._url_log)
logging.debug('Image restore params:')