From 70f1d0d71de033183fb2aed5533ec6937780a5a0 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Thu, 1 Dec 2022 15:22:58 +0100 Subject: 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. --- src/live/ogOperations.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 61da45b..bfa54c5 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -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:') -- cgit v1.2.3-18-g5258