From: Daan De Meyer Date: Mon, 1 May 2023 07:45:06 +0000 (+0200) Subject: Don't fail if we can't retrieve default credentials X-Git-Tag: v15~188^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22fd822350a945015230cebb9c2ca80414816c5b;p=thirdparty%2Fmkosi.git Don't fail if we can't retrieve default credentials Let's not fail if we can't run ssh-add or timedatectl to get the SSH key or timezone. --- diff --git a/mkosi/config.py b/mkosi/config.py index 2eef4e870..5bafdacfd 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -1836,8 +1836,10 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]: ["timedatectl", "show", "-p", "Timezone", "--value"], text=True, stdout=subprocess.PIPE, + check=False, ).stdout.strip() - creds["firstboot.timezone"] = tz + if tz: + creds["firstboot.timezone"] = tz if "firstboot.locale" not in creds: creds["firstboot.locale"] = "C.UTF-8" @@ -1851,8 +1853,10 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]: text=True, stdout=subprocess.PIPE, env=os.environ, + check=False, ).stdout.strip() - creds["ssh.authorized_keys.root"] = key + if key: + creds["ssh.authorized_keys.root"] = key return creds