Fix crash with autoinstall on non-systemd env

On WSL and any system without systemd the server crashes becauses
the syslog id is always set (and never None) and systemd cat cannot
connect to the journal.
We cant set the id to None because the API expects a string, so the
check "is not None" is always true.

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
This commit is contained in:
Jean-Baptiste Lallement 2021-10-04 13:09:24 -07:00
parent 636b4401d2
commit 6cc8c6169b
2 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class CmdListController(NonInteractiveController):
with context.child("command_{}".format(i), desc):
if isinstance(cmd, str):
cmd = ['sh', '-c', cmd]
if self.syslog_id is not None:
if self.syslog_id:
journal.send(
" running " + desc, SYSLOG_IDENTIFIER=self.syslog_id)
cmd = [

View File

@ -55,6 +55,9 @@ class SystemSetupServer(SubiquityServer):
def __init__(self, opts, block_log_dir):
super().__init__(opts, block_log_dir)
self.echo_syslog_id = ""
self.event_syslog_id = ""
self.log_syslog_id = ""
if is_reconfigure(opts.dry_run):
self.set_source_variant("wsl_configuration")