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.
This commit is contained in:
Chris Peterson 2024-03-20 16:04:42 -07:00
parent 980411a670
commit 0eb05d31e1
1 changed files with 6 additions and 5 deletions

View File

@ -265,10 +265,9 @@ class SubiquityClient(TuiApplication):
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 @@ class SubiquityClient(TuiApplication):
# 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))