Skip to content

Commit

Permalink
webui: Saving webui-desktop log to anaconda.log
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Aug 20, 2024
1 parent a013567 commit ff106f2
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions pyanaconda/ui/webui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from pyanaconda import ui
from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.anaconda_logging import program_log_lock
from pyanaconda.core.constants import QUIT_MESSAGE, PAYLOAD_TYPE_DNF, WEBUI_VIEWER_PID_FILE, \
BACKEND_READY_FLAG_FILE
from pyanaconda.core.util import startProgram
Expand Down Expand Up @@ -141,14 +142,35 @@ def _run_webui(self):
# FIXME: We probably want to move this to early execution similar to what we have on live
profile_name = FIREFOX_THEME_DEFAULT

proc = startProgram(["/usr/libexec/webui-desktop",
"-t", profile_name, "-r", str(int(self.remote)),
"/cockpit/@localhost/anaconda-webui/index.html"],
reset_lang=False)
log.debug("cockpit web view has been started")
with open(self._viewer_pid_file, "w") as f:
f.write(repr(proc.pid))
proc.wait()
try:
proc = startProgram(
["/usr/libexec/webui-desktop",
"-t", profile_name, "-r", str(int(self.remote)),
"/cockpit/@localhost/anaconda-webui/index.html"]
)

log.debug("cockpit web view has been started")
with open(self._viewer_pid_file, "w") as f:
f.write(repr(proc.pid))

(output_string, err_string) = proc.communicate()
output_string = output_string.decode("utf-8", "replace")
err_string = err_string.decode("utf-8", "replace")

with program_log_lock:
if output_string:
for line in output_string.splitlines():
log.info(line)

if err_string:
log.error("Errors from webui-desktop:")
for line in err_string.splitlines():
log.error(line)
proc.wait()
except OSError as e:
with program_log_lock:
log.error("Error running webui-desktop: %s", e.strerror)
raise

def _watch_webui_on_live(self):
"""Watch webui-desktop script process on Live.
Expand Down

0 comments on commit ff106f2

Please sign in to comment.