]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix default file parsing of store_true options 64/head
authorLucas Werkmeister <mail@lucaswerkmeister.de>
Sun, 26 Feb 2017 23:02:19 +0000 (00:02 +0100)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Sun, 26 Feb 2017 23:02:19 +0000 (00:02 +0100)
With action='store_true', argparse adds a default value of False if the
option isn’t specified, so it could never be None.

mkosi

diff --git a/mkosi b/mkosi
index 8ff86c4685dad4fa5c25f5cc44cea6bfed22d5de..ade0e2df9785cc7c53b22693da39f2860a03458c 100755 (executable)
--- a/mkosi
+++ b/mkosi
@@ -1708,7 +1708,7 @@ def process_setting(args, section, key, value):
             if args.output is None:
                 args.output = value
         elif key == "Force":
-            if args.force is None:
+            if not args.force:
                 args.force = parse_boolean(value)
         elif key == "Bootable":
             if args.bootable is None:
@@ -1717,7 +1717,7 @@ def process_setting(args, section, key, value):
             if args.kernel_commandline is None:
                 args.kernel_commandline = value
         elif key == "SecureBoot":
-            if args.secure_boot is None:
+            if not args.secure_boot:
                 args.secure_boot = parse_boolean(value)
         elif key == "SecureBootKey":
             if args.secure_boot_key is None:
@@ -1726,7 +1726,7 @@ def process_setting(args, section, key, value):
             if args.secure_boot_certificate is None:
                 args.secure_boot_certificate = value
         elif key == "ReadOnly":
-            if args.read_only is None:
+            if not args.read_only:
                 args.read_only = parse_boolean(value)
         elif key == "Encrypt":
             if args.encrypt is None:
@@ -1734,13 +1734,13 @@ def process_setting(args, section, key, value):
                     raise ValueError("Invalid encryption setting: "+ value)
                 args.encrypt = value
         elif key == "Verity":
-            if args.verity is None:
+            if not args.verity:
                 args.verity = parse_boolean(value)
         elif key == "Compress":
-            if args.compress is None:
+            if not args.compress:
                 args.compress = parse_boolean(value)
         elif key == "XZ":
-            if args.xz is None:
+            if not args.xz:
                 args.xz = parse_boolean(value)
         elif key is None:
             return True
@@ -1754,7 +1754,7 @@ def process_setting(args, section, key, value):
             else:
                 args.packages.extend(list_value)
         elif key == "WithDocs":
-            if args.with_docs is None:
+            if not args.with_docs:
                 args.with_docs = parse_boolean(value)
         elif key == "Cache":
             if args.cache_path is None:
@@ -1809,10 +1809,10 @@ def process_setting(args, section, key, value):
             return False
     elif section == "Validation":
         if key == "CheckSum":
-            if args.checksum is None:
+            if not args.checksum:
                 args.checksum = parse_boolean(value)
         elif key == "Sign":
-            if args.sign is None:
+            if not args.sign:
                 args.sign = parse_boolean(value)
         elif key == "Key":
             if args.key is None: