]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Store finalized values only on config object
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 6 Aug 2024 07:55:56 +0000 (09:55 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 6 Aug 2024 07:55:56 +0000 (09:55 +0200)
This allows us to use context.config to determine whether a value
was specified in a configuration file or not.

mkosi/config.py

index 2eeebb9d53f226eb7cde6769580db9946fa96ee0..c919a3473c1c26d0faa19b0d9f897eac67e637f6 100644 (file)
@@ -3807,13 +3807,14 @@ def parse_config(argv: Sequence[str] = (), *, resources: Path = Path("/")) -> tu
     if args.directory is not None:
         context.parse_config_one(Path("."), profiles=True, local=True)
 
+    config = copy.deepcopy(context.config)
+
     # After we've finished parsing the configuration, we'll have values in both
     # namespaces (context.cli, context.config). To be able to parse the values from a
     # single namespace, we merge the final values of each setting into one namespace.
     for s in SETTINGS:
-        setattr(context.config, s.dest, context.finalize_value(s))
+        setattr(config, s.dest, context.finalize_value(s))
 
-    config = copy.deepcopy(context.config)
     images = []
 
     if args.directory is not None and Path("mkosi.images").exists():