Re: [PATCH 1/4] Pass InstalltData to booty __init__ as it needs access to many of its members

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

 



Hans de Goede wrote:
Currently we are passing storage and network to booty's __init__, for
writing the necessary kernel cmdline parameters for dracut for international
consoles / keyboards booty will also need access to keyboard and language,
instead of passing these all in seperately just pass InstalltData to booty's
__init__. This is a preparation patch for writing out the dracut kernel
cmdline commands for i18n support.
---
 booty/__init__.py       |   16 ++++++++--------
 booty/alpha.py          |    4 ++--
 booty/bootloaderInfo.py |   23 +++++++++++------------
 booty/ia64.py           |    4 ++--
 booty/ppc.py            |    4 ++--
 booty/s390.py           |    4 ++--
 booty/sparc.py          |    4 ++--
 booty/x86.py            |    6 +++---
 instdata.py             |    2 +-
 9 files changed, 33 insertions(+), 34 deletions(-)


Looks ok to me.

diff --git a/booty/__init__.py b/booty/__init__.py
index 8f2d6a7..f0b571d 100644
--- a/booty/__init__.py
+++ b/booty/__init__.py
@@ -28,25 +28,25 @@ class BootyNoKernelWarning:
         return self.value
# return instance of the appropriate bootloader for our arch
-def getBootloader(storage, network):
+def getBootloader(instData):
     """Get the bootloader info object for your architecture"""
     if iutil.isX86():
         import x86
-        return x86.x86BootloaderInfo(storage, network)
+        return x86.x86BootloaderInfo(instData)
     elif iutil.isIA64():
         import ia64
-        return ia64.ia64BootloaderInfo(storage, network)
+        return ia64.ia64BootloaderInfo(instData)
     elif iutil.isS390():
         import s390
-        return s390.s390BootloaderInfo(storage, network)
+        return s390.s390BootloaderInfo(instData)
     elif iutil.isAlpha():
         import alpha
-        return alpha.alphaBootloaderInfo(storage, network)
+        return alpha.alphaBootloaderInfo(instData)
     elif iutil.isPPC():
         import ppc
-        return ppc.ppcBootloaderInfo(storage, network)
+        return ppc.ppcBootloaderInfo(instData)
     elif iutil.isSparc():
         import sparc
-        return sparc.sparcBootloaderInfo(storage, network)
+        return sparc.sparcBootloaderInfo(instData)
     else:
-        return bootloaderInfo(storage, network)
+        return bootloaderInfo(instData)
diff --git a/booty/alpha.py b/booty/alpha.py
index 9f7c7cf..8384162 100644
--- a/booty/alpha.py
+++ b/booty/alpha.py
@@ -142,8 +142,8 @@ class alphaBootloaderInfo(bootloaderInfo):
         return self.writeAboot(instRoot, bl, kernelList,
                                chainList, defaultDev, justConfig)
- def __init__(self, storage, network):
-        bootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        bootloaderInfo.__init__(self, instData)
         self.useGrubVal = 0
         self.configfile = "/etc/aboot.conf"
         # self.kernelLocation is already set to what we need.
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 7f226c3..817a000 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -88,8 +88,8 @@ class KernelArguments:
def get(self):
         args = self.args
-        root = self.storage.fsset.rootDevice
-        for d in self.storage.devices:
+        root = self.id.storage.fsset.rootDevice
+        for d in self.id.storage.devices:
             if root.dependsOn(d):
                 dracutSetupString = d.dracutSetupString()
                 if len(dracutSetupString):
@@ -97,7 +97,7 @@ class KernelArguments:
                 import storage
                 if isinstance(d, storage.devices.NetworkStorageDevice):
                     args += " "
-                    args += self.network.dracutSetupString(d.host_address)
+                    args += self.id.network.dracutSetupString(d.host_address)
return args @@ -119,7 +119,7 @@ class KernelArguments:
         self.args = self.args + "%s" % (args,)
- def __init__(self, storage, network):
+    def __init__(self, instData):
         newArgs = []
         cfgFilename = "/tmp/install.cfg"
@@ -156,8 +156,7 @@ class KernelArguments:
                 newArgs.append(arg)
self.args = " ".join(newArgs)
-        self.storage = storage
-        self.network = network
+        self.id = instData
class BootImages:
@@ -481,8 +480,8 @@ class bootloaderInfo:
         self._drivelist = val
     drivelist = property(_getDriveList, _setDriveList)
- def __init__(self, storage, network):
-        self.args = KernelArguments(storage, network)
+    def __init__(self, instData):
+        self.args = KernelArguments(instData)
         self.images = BootImages()
         self.device = None
         self.defaultDevice = None  # XXX hack, used by kickstart
@@ -494,7 +493,7 @@ class bootloaderInfo:
         self.pure = None
         self.above1024 = 0
         self.timeout = None
-        self.storage = storage
+        self.storage = instData.storage
# this has somewhat strange semantics. if 0, act like a normal
         # "install" case.  if 1, update lilo.conf (since grubby won't do that)
@@ -619,11 +618,11 @@ class efiBootloaderInfo(bootloaderInfo):
             return rc
         return self.addNewEfiEntry(instRoot)
- def __init__(self, storage, network, initialize = True):
+    def __init__(self, instData, initialize = True):
         if initialize:
-            bootloaderInfo.__init__(self, storage, network)
+            bootloaderInfo.__init__(self, instData)
         else:
-            self.storage = storage
+            self.storage = instData.storage
if iutil.isEfi():
             self._configdir = "/boot/efi/EFI/redhat"
diff --git a/booty/ia64.py b/booty/ia64.py
index c5bd42e..bf2689f 100644
--- a/booty/ia64.py
+++ b/booty/ia64.py
@@ -36,7 +36,7 @@ class ia64BootloaderInfo(efiBootloaderInfo):
     def makeInitrd(self, kernelTag):
         return "/boot/efi/EFI/redhat/initrd%s.img" % kernelTag
- def __init__(self, storage, network):
-        efiBootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        efiBootloaderInfo.__init__(self, instData)
         self._configname = "elilo.conf"
         self._bootloader = "elilo.efi"
diff --git a/booty/ppc.py b/booty/ppc.py
index 2143c14..5b96be7 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -174,8 +174,8 @@ class ppcBootloaderInfo(bootloaderInfo):
return 0 - def __init__(self, storage, network):
-        bootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        bootloaderInfo.__init__(self, instData)
         self.useYabootVal = 1
         self.kernelLocation = "/boot"
         self.configfile = "/etc/yaboot.conf"
diff --git a/booty/s390.py b/booty/s390.py
index 8e46fab..e865931 100644
--- a/booty/s390.py
+++ b/booty/s390.py
@@ -171,8 +171,8 @@ class s390BootloaderInfo(bootloaderInfo):
return self.writeChandevConf(bl, instRoot) - def __init__(self, storage, network):
-        bootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        bootloaderInfo.__init__(self, instData)
         self.useZiplVal = 1      # only used on s390
         self.kernelLocation = "/boot/"
         self.configfile = "/etc/zipl.conf"
diff --git a/booty/sparc.py b/booty/sparc.py
index 9154ac3..5b379b9 100644
--- a/booty/sparc.py
+++ b/booty/sparc.py
@@ -121,8 +121,8 @@ class sparcBootloaderInfo(bootloaderInfo):
         else:
             raise BootyNoKernelWarning
- def __init__(self, storage, network):
-        bootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        bootloaderInfo.__init__(self, instData)
         self.useSiloVal = 1
         self.kernelLocation = "/boot"
         self._configdir = "/etc"
diff --git a/booty/x86.py b/booty/x86.py
index 97354fc..d9bebcb 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -578,15 +578,15 @@ class x86BootloaderInfo(efiBootloaderInfo):
return args - def __init__(self, storage, network):
-        bootloaderInfo.__init__(self, storage, network)
+    def __init__(self, instData):
+        bootloaderInfo.__init__(self, instData)
# these have to be set /before/ efiBootloaderInfo.__init__(), or
         # they'll be overwritten.
         self._configdir = "/boot/grub"
         self._configname = "grub.conf"
- efiBootloaderInfo.__init__(self, storage, network, initialize=False)
+        efiBootloaderInfo.__init__(self, instData, initialize=False)
# XXX use checkbootloader to determine what to default to
         self.useGrubVal = 1
diff --git a/instdata.py b/instdata.py
index b3497b3..fdb1a32 100644
--- a/instdata.py
+++ b/instdata.py
@@ -74,7 +74,7 @@ class InstallData:
         if flags.cmdline.has_key("preupgrade"):
             self.upgrade = True
         self.storage = storage.Storage(self.anaconda)
-        self.bootloader = booty.getBootloader(self.storage, self.network)
+        self.bootloader = booty.getBootloader(self)
         self.upgradeRoot = None
         self.rootParts = None
         self.upgradeSwapInfo = None

_______________________________________________
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