From: Daan De Meyer Date: Fri, 15 Dec 2023 09:53:11 +0000 (+0100) Subject: Only query credentials when they're needed X-Git-Tag: v20~57^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1c312ef5caf35251fa45f8dbb2c7acb7a7ff8f0;p=thirdparty%2Fmkosi.git Only query credentials when they're needed We might run commands that potentially need some time to complete so let's only run them when needed. --- diff --git a/mkosi/config.py b/mkosi/config.py index 608e1b25b..320f770b5 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -87,6 +87,9 @@ class Verb(StrEnum): def needs_root(self) -> bool: return self in (Verb.shell, Verb.boot, Verb.burn) + def needs_credentials(self) -> bool: + return self in (Verb.summary, Verb.qemu, Verb.boot, Verb.shell) + class ConfigFeature(StrEnum): auto = enum.auto() @@ -2794,6 +2797,9 @@ def parse_config(argv: Sequence[str] = ()) -> tuple[MkosiArgs, tuple[MkosiConfig def load_credentials(args: argparse.Namespace) -> dict[str, str]: + if not args.verb.needs_credentials(): + return {} + creds = { "agetty.autologin": "root", "login.noauth": "yes",