Skip to content

Commit

Permalink
client: support log-like events in non-interactive installs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris-Peterson444 committed Mar 20, 2024
1 parent 980411a commit 0eb05d3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions subiquity/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 0eb05d3

Please sign in to comment.