[PATCH 2/3] Replace ifs when assigning option values to flags where possible

Martin Kolman mkolman at redhat.com
Wed Jun 18 12:24:06 UTC 2014


Also move the direct option -> flag assignments to a single place.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 anaconda | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/anaconda b/anaconda
index 803de8f..4d4cb0c 100755
--- a/anaconda
+++ b/anaconda
@@ -763,9 +763,6 @@ if __name__ == "__main__":
     from pyanaconda.flags import flags, can_touch_runtime_system
     (opts, depr) = parseArguments(boot_cmdline=flags.cmdline)
 
-    if opts.askmethod:
-        flags.askmethod = True
-
     # Set up logging as early as possible.
     import logging
     from pyanaconda import anaconda_log
@@ -872,9 +869,6 @@ if __name__ == "__main__":
     if opts.stage2:
         anaconda.stage2 = opts.stage2
 
-    if opts.noverifyssl:
-        flags.noverifyssl = True
-
     if opts.liveinst:
         from pyanaconda.screensaver import inhibit_screensaver
         from pyanaconda import safe_dbus
@@ -890,21 +884,15 @@ if __name__ == "__main__":
     elif "LIVECMD" in os.environ:
         log.warning("Running via liveinst, but not setting flags.livecdInstall - this is for testing only")
 
-    if opts.targetArch:
-        flags.targetarch = opts.targetArch
-
-    if opts.armPlatform:
-        flags.armPlatform = opts.armPlatform
-
-    if opts.extlinux:
-        flags.extlinux = opts.extlinux
-
-    if opts.dnf:
-        flags.dnf = opts.dnf
-
-    flags.mpathFriendlyNames = opts.mpathfriendlynames
-
     # set flags
+    flags.noverifyssl = opts.noverifyssl
+    flags.targetarch = opts.targetArch
+    flags.armPlatform = opts.armPlatform
+    flags.extlinux = opts.extlinux
+    flags.dnf = opts.dnf
+    flags.mpathFriendlyNames = opts.mpathfriendlynames
+    flags.debug = opts.debug
+    flags.askmethod = opts.askmethod
     flags.dmraid = opts.dmraid
     flags.mpath = opts.mpath
     flags.ibft = opts.ibft
@@ -923,9 +911,6 @@ if __name__ == "__main__":
         except OSError:
             pass
 
-    if opts.debug:
-        flags.debug = True
-
     if opts.rescue:
         anaconda.rescue = True
 
-- 
1.9.3



More information about the anaconda-patches mailing list