Skip to content

Commit

Permalink
config: persist CLI configuration
Browse files Browse the repository at this point in the history
Report the valid command-line configuration options.

Closes: systemd#1993
  • Loading branch information
Tj committed Feb 10, 2024
1 parent 2fd8cda commit 5ee95ea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3174,8 +3174,10 @@ def finalize_defaults(namespace: argparse.Namespace, defaults: argparse.Namespac
finalize_defaults(namespace, defaults)
images = [namespace]

cli_valid = dict({key: getattr(cli_ns, key) for key in vars(cli_ns)})
for s in vars(cli_ns):
if s not in SETTINGS_LOOKUP_BY_DEST:
del cli_valid[s]
continue

if getattr(cli_ns, s) is None:
Expand All @@ -3194,6 +3196,14 @@ def finalize_defaults(namespace: argparse.Namespace, defaults: argparse.Namespac
hint="Prefix the setting with '@' in the image configuration file to allow overriding it from the command line.", # noqa: E501
)

commandline=""
for key in cli_valid:
value = cli_valid[key]
commandline+=" --{!s}={!s}".format(key, value)

if len(commandline) > 0:
logging.info(f"CLI: {commandline}")

if not images:
die("No images defined in mkosi.images/")

Expand Down

0 comments on commit 5ee95ea

Please sign in to comment.