[PATCH 1/4] Avoid duplicate kernel cmdline options and cleanup booty dracut code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is possible for 2 disks to have the same disk dracut cmdline options,
or network cmdline options (if the disks are network devices) for example
2 iscsi disks on the same host. In this case we should only include the
specific option once.

This patch puts the collection of storage related setupStrings in a function,
and makes get() loop over all kernel cmdline providing bits, so that the
code for proper whitespace seperation of various args is not duplicated.
---
 booty/bootloaderInfo.py |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 067ffa7..6e6d403 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -86,26 +86,35 @@ def rootIsDevice(dev):
 
 class KernelArguments:
 
-    def get(self):
-        args = self.args
+    def getDracutStorageArgs(self):
+        args = []
         root = self.id.storage.rootDevice
         for d in self.id.storage.devices:
-            if root.dependsOn(d):
-                dracutSetupString = d.dracutSetupString()
-                if len(dracutSetupString):
-                    args += " %s" % dracutSetupString
-                import storage
-                if isinstance(d, storage.devices.NetworkStorageDevice):
-                    args += " "
-                    args += self.id.network.dracutSetupString(d)
-
-        args += self.id.instLanguage.dracutSetupString()
-        args += self.id.keyboard.dracutSetupString()
-
-        if args and self.appendArgs:
-            args += " "
-
-        return args + self.appendArgs
+            if not root.dependsOn(d):
+                continue
+
+            args.append(d.dracutSetupString())
+            import storage
+            if isinstance(d, storage.devices.NetworkStorageDevice):
+                args.append(self.id.network.dracutSetupString(d))
+
+        return args
+
+    def get(self):
+        args = ""
+        for s in self.getDracutStorageArgs() + [
+                 self.id.instLanguage.dracutSetupString(),
+                 self.id.keyboard.dracutSetupString(),
+                 self.args,
+                 self.appendArgs ]:
+            s = s.strip()
+            if not s:
+                continue
+            if args:
+                args += " "
+            args += s
+
+        return args
 
     def set(self, args):
         self.args = args
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux