From 0eb05d31e1d7cbd565e5a81d74102b47e57b626e Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Wed, 20 Mar 2024 16:04:42 -0700 Subject: [PATCH] client: support log-like events in non-interactive installs This changes the journal listener callback in the non-interactive scenario to support all types of events, not just start and finish events. This also modifies the journal listener in the non-interactive scenario to not seek all the way to the newest entry. In non-interactive installs, the server can get pretty far into the installation by the time the client can connect, so any important warnings/errors that the server reports before then wouldn't be printed to the console by the client otherwise. --- subiquity/client/client.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/subiquity/client/client.py b/subiquity/client/client.py index 88b7fde3d..d16080bec 100644 --- a/subiquity/client/client.py +++ b/subiquity/client/client.py @@ -265,10 +265,9 @@ async def noninteractive_watch_app_state(self, initial_status): app_status = await self._status_get(app_state) def subiquity_event_noninteractive(self, event): - if event["SUBIQUITY_EVENT_TYPE"] == "start": - print("start: " + event["MESSAGE"]) - elif event["SUBIQUITY_EVENT_TYPE"] == "finish": - print("finish: " + event["MESSAGE"]) + event_type = event["SUBIQUITY_EVENT_TYPE"] + message = event["MESSAGE"] + print(f"{event_type}: {message}") async def connect(self): def p(s): @@ -379,7 +378,9 @@ def header_func(): # prompting for confirmation will be confusing. os.system("stty sane") journald_listen( - [status.event_syslog_id], self.subiquity_event_noninteractive, seek=True + [status.event_syslog_id], + self.subiquity_event_noninteractive, + seek=False, ) run_bg_task(self.noninteractive_watch_app_state(status))