From: Georges Discry Date: Sun, 23 Apr 2023 12:47:44 +0000 (+0200) Subject: Allow setting empty environment variables X-Git-Tag: v15~213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a74cea3e96a394336f3777e1f6e01ef8af615f19;p=thirdparty%2Fmkosi.git Allow setting empty environment variables Trying to set an empty environment variable with `FOO=` would instead pass the `FOO` variable from the host, which is the expected behavior when `=` is missing. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 5a66cba1e..f6352455b 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1210,8 +1210,8 @@ def load_args(args: argparse.Namespace) -> MkosiConfig: if args.environment: env = {} for s in args.environment: - key, _, value = s.partition("=") - value = value or os.getenv(key, "") + key, sep, value = s.partition("=") + value = value if sep else os.getenv(key, "") env[key] = value args.environment = env else: