diff options
author | Chris Lumens <clumens@redhat.com> | 2009-12-17 23:30:22 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2010-02-04 14:07:28 -0500 |
commit | 5254ceaa579914280c4423aada787c2a150cd7ea (patch) | |
tree | f00974a3215ac4b387f8bfbee731e33079e6d632 | |
parent | 27e7a063c9890ec13bab468854c3d0a263dd21d6 (diff) | |
download | anaconda-5254ceaa579914280c4423aada787c2a150cd7ea.tar.gz anaconda-5254ceaa579914280c4423aada787c2a150cd7ea.tar.xz anaconda-5254ceaa579914280c4423aada787c2a150cd7ea.zip |
Move ksdata to be an attribute on Anaconda.
-rwxr-xr-x | anaconda | 42 | ||||
-rw-r--r-- | bootloader.py | 4 | ||||
-rw-r--r-- | exception.py | 2 | ||||
-rw-r--r-- | instdata.py | 22 | ||||
-rw-r--r-- | kickstart.py | 44 | ||||
-rw-r--r-- | rescue.py | 2 | ||||
-rw-r--r-- | upgrade.py | 6 | ||||
-rw-r--r-- | yuminstall.py | 8 |
8 files changed, 61 insertions, 69 deletions
@@ -451,6 +451,7 @@ class Anaconda: self.intf = None self.isHeadless = False self.isKickstart = False + self.ksdata = None self.mediaDevice = None self.methodstr = None self.platform = None @@ -765,14 +766,14 @@ if __name__ == "__main__": anaconda.isKickstart = True kickstart.preScriptPass(anaconda, opts.ksfile) - ksdata = kickstart.parseKickstart(anaconda, opts.ksfile) - opts.rescue = ksdata.rescue.rescue + anaconda.ksdata = kickstart.parseKickstart(anaconda, opts.ksfile) + opts.rescue = anaconda.ksdata.rescue.rescue # we need to have a libuser.conf that points to the installer root for # sshpw, but after that we start sshd, we need one that points to the # install target. luserConf = users.createLuserConf(instPath="") - handleSshPw(ksdata) + handleSshPw(anaconda.ksdata) startSsh() del(os.environ["LIBUSER_CONF"]) @@ -787,7 +788,6 @@ if __name__ == "__main__": if anaconda.isKickstart: instClass.setInstallData(anaconda) - anaconda.id.setKsdata(ksdata) # We need an interface before running kickstart execute methods for # storage. @@ -795,13 +795,13 @@ if __name__ == "__main__": screen = SnackScreen() anaconda.intf = rescue.RescueInterface(screen) - ksdata.execute() + anaconda.ksdata.execute() anaconda.intf = None screen.finish() # command line 'nomount' overrides kickstart /same for vnc/ - anaconda.rescue_mount = not (opts.rescue_nomount or anaconda.id.ksdata.rescue.nomount) + anaconda.rescue_mount = not (opts.rescue_nomount or anaconda.ksdata.rescue.nomount) rescue.runRescue(anaconda, instClass) @@ -809,18 +809,18 @@ if __name__ == "__main__": sys.exit(1) if anaconda.isKickstart: - if ksdata.vnc.enabled: + if anaconda.ksdata.vnc.enabled: flags.usevnc = 1 anaconda.displayMode = 'g' if vncS.password == "": - vncS.password = ksdata.vnc.password + vncS.password = anaconda.ksdata.vnc.password if vncS.vncconnecthost == "": - vncS.vncconnecthost = ksdata.vnc.host + vncS.vncconnecthost = anaconda.ksdata.vnc.host if vncS.vncconnectport == "": - vncS.vncconnectport = ksdata.vnc.port + vncS.vncconnectport = anaconda.ksdata.vnc.port flags.vncquestion = False @@ -1002,26 +1002,24 @@ if __name__ == "__main__": if anaconda.isKickstart: import storage - anaconda.id.setKsdata(ksdata) - # Before we set up the storage system, we need to know which disks to # ignore, etc. Luckily that's all in the kickstart data. - anaconda.id.storage.zeroMbr = ksdata.zerombr.zerombr - anaconda.id.storage.ignoredDisks = ksdata.ignoredisk.ignoredisk - anaconda.id.storage.exclusiveDisks = ksdata.ignoredisk.onlyuse + anaconda.id.storage.zeroMbr = anaconda.ksdata.zerombr.zerombr + anaconda.id.storage.ignoredDisks = anaconda.ksdata.ignoredisk.ignoredisk + anaconda.id.storage.exclusiveDisks = anaconda.ksdata.ignoredisk.onlyuse - if ksdata.clearpart.type is not None: - anaconda.id.storage.clearPartType = ksdata.clearpart.type - anaconda.id.storage.clearPartDisks = ksdata.clearpart.drives - if ksdata.clearpart.initAll: - anaconda.id.storage.reinitializeDisks = ksdata.clearpart.initAll + if anaconda.ksdata.clearpart.type is not None: + anaconda.id.storage.clearPartType = anaconda.ksdata.clearpart.type + anaconda.id.storage.clearPartDisks = anaconda.ksdata.clearpart.drives + if anaconda.ksdata.clearpart.initAll: + anaconda.id.storage.reinitializeDisks = anaconda.ksdata.clearpart.initAll storage.storageInitialize(anaconda) # Now having initialized storage, we can apply all the other kickstart # commands. This gives us the ability to check that storage commands # are correctly formed and refer to actual devices. - ksdata.execute() + anaconda.ksdata.execute() # set up the headless case if anaconda.isHeadless: @@ -1037,7 +1035,7 @@ if __name__ == "__main__": except SystemExit, code: anaconda.intf.shutdown() - if anaconda.isKickstart and anaconda.id.ksdata.reboot.eject: + if anaconda.isKickstart and anaconda.ksdata.reboot.eject: for drive in anaconda.id.storage.devicetree.devices: if drive.type != "cdrom": continue diff --git a/bootloader.py b/bootloader.py index 5ef6729d4..b4dac5ba3 100644 --- a/bootloader.py +++ b/bootloader.py @@ -63,8 +63,8 @@ def bootloaderSetupChoices(anaconda): sys.exit(0) return DISPATCH_FORWARD - if anaconda.id.ksdata and anaconda.id.ksdata.bootloader.driveorder: - anaconda.id.bootloader.updateDriveList(anaconda.id.ksdata.bootloader.driveorder) + if anaconda.ksdata and anaconda.ksdata.bootloader.driveorder: + anaconda.id.bootloader.updateDriveList(anaconda.ksdata.bootloader.driveorder) else: #We want the selected bootloader drive to be preferred pref = anaconda.id.bootloader.drivelist[:1] diff --git a/exception.py b/exception.py index b54fcf326..1ad7db285 100644 --- a/exception.py +++ b/exception.py @@ -100,7 +100,7 @@ def initExceptionHandling(anaconda): "id.comps", "id.dispatch", "id.hdList", - "id.ksdata", + "ksdata", "id.instLanguage.font", "id.instLanguage.kbd", "id.instLanguage.info", diff --git a/instdata.py b/instdata.py index e235b5895..f1487387b 100644 --- a/instdata.py +++ b/instdata.py @@ -85,15 +85,9 @@ class InstallData: else: self.firstboot = FIRSTBOOT_DEFAULT - # XXX I still expect this to die when kickstart is the data store. - self.ksdata = None - def setInstallProgressClass(self, c): self.instProgress = c - def setKsdata(self, ksdata): - self.ksdata = ksdata - # if upgrade is None, it really means False. we use None to help the # installer ui figure out if it's the first time the user has entered # the examine_gui screen. --dcantrell @@ -157,25 +151,25 @@ class InstallData: algo=self.getPassAlgo()) if self.anaconda.isKickstart: - for svc in self.ksdata.services.disabled: + for svc in self.anaconda.ksdata.services.disabled: iutil.execWithRedirect("/sbin/chkconfig", [svc, "off"], stdout="/dev/tty5", stderr="/dev/tty5", root=self.anaconda.rootPath) - for svc in self.ksdata.services.enabled: + for svc in self.anaconda.ksdata.services.enabled: iutil.execWithRedirect("/sbin/chkconfig", [svc, "on"], stdout="/dev/tty5", stderr="/dev/tty5", root=self.anaconda.rootPath) - for gd in self.ksdata.group.groupList: + for gd in self.anaconda.ksdata.group.groupList: if not self.users.createGroup(name=gd.name, gid=gd.gid, root=self.anaconda.rootPath): log.error("Group %s already exists, not creating." % gd.name) - for ud in self.ksdata.user.userList: + for ud in self.anaconda.ksdata.user.userList: if not self.users.createUser(name=ud.name, password=ud.password, isCrypted=ud.isCrypted, @@ -247,9 +241,9 @@ class InstallData: # component. If this is a kickstart install, we need to make sure # the information from the input file ends up in the output file. if self.anaconda.isKickstart: - f.write(self.ksdata.user.__str__()) - f.write(self.ksdata.services.__str__()) - f.write(self.ksdata.reboot.__str__()) + f.write(self.anaconda.ksdata.user.__str__()) + f.write(self.anaconda.ksdata.services.__str__()) + f.write(self.anaconda.ksdata.reboot.__str__()) self.firewall.writeKS(f) if self.auth.strip() != "": @@ -265,7 +259,7 @@ class InstallData: # Also write out any scripts from the input ksfile. if self.anaconda.isKickstart: - for s in self.ksdata.scripts: + for s in self.anaconda.ksdata.scripts: f.write(s.__str__()) # make it so only root can read, could have password diff --git a/kickstart.py b/kickstart.py index ce3939cec..f806bd05a 100644 --- a/kickstart.py +++ b/kickstart.py @@ -198,7 +198,7 @@ class AutoPart(commands.autopart.F12_AutoPart): anaconda.id.storage.autoPartAddBackupPassphrase = \ self.backuppassphrase - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) class AutoStep(commands.autostep.FC3_AutoStep): def execute(self, anaconda): @@ -222,9 +222,9 @@ class Bootloader(commands.bootloader.F12_Bootloader): anaconda.id.bootloader.doUpgradeOnly = 1 if location is None: - anaconda.id.ksdata.permanentSkipSteps.extend(["bootloadersetup", "instbootloader"]) + anaconda.ksdata.permanentSkipSteps.extend(["bootloadersetup", "instbootloader"]) else: - anaconda.id.ksdata.showSteps.append("bootloader") + anaconda.ksdata.showSteps.append("bootloader") if self.appendLine: anaconda.id.bootloader.args.append(self.appendLine) @@ -270,7 +270,7 @@ class Bootloader(commands.bootloader.F12_Bootloader): anaconda.id.bootloader.updateDriveList(new) - anaconda.id.ksdata.permanentSkipSteps.extend(["upgbootloader", "bootloader"]) + anaconda.ksdata.permanentSkipSteps.extend(["upgbootloader", "bootloader"]) class ClearPart(commands.clearpart.FC3_ClearPart): def parse(self, args): @@ -432,7 +432,7 @@ class LogVolData(commands.logvol.F12_LogVolData): dev.format.mountpoint = self.mountpoint dev.format.mountopts = self.fsopts - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) return # Make sure this LV name is not already used in the requested VG. @@ -513,7 +513,7 @@ class LogVolData(commands.logvol.F12_LogVolData): parents=request) storage.createDevice(luksdev) - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) class Logging(commands.logging.FC6_Logging): def execute(self, anaconda): @@ -639,7 +639,7 @@ class PartitionData(commands.partition.F12_PartData): # store "raid." alias for other ks partitioning commands if self.onPart: - anaconda.id.ksdata.onPart[kwargs["name"]] = self.onPart + anaconda.ksdata.onPart[kwargs["name"]] = self.onPart self.mountpoint = "" elif self.mountpoint.startswith("pv."): type = "lvmpv" @@ -650,7 +650,7 @@ class PartitionData(commands.partition.F12_PartData): # store "pv." alias for other ks partitioning commands if self.onPart: - anaconda.id.ksdata.onPart[kwargs["name"]] = self.onPart + anaconda.ksdata.onPart[kwargs["name"]] = self.onPart self.mountpoint = "" elif self.mountpoint == "/boot/efi": type = "EFI System Partition" @@ -676,7 +676,7 @@ class PartitionData(commands.partition.F12_PartData): dev.format.mountpoint = self.mountpoint dev.format.mountopts = self.fsopts - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) return # Size specification checks. @@ -765,11 +765,11 @@ class PartitionData(commands.partition.F12_PartData): parents=request) storage.createDevice(luksdev) - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) class Reboot(commands.reboot.FC6_Reboot): def execute(self, anaconda): - anaconda.id.ksdata.skipSteps.append("complete") + anaconda.ksdata.skipSteps.append("complete") class RaidData(commands.raid.F12_RaidData): def execute(self, anaconda): @@ -788,7 +788,7 @@ class RaidData(commands.raid.F12_RaidData): elif self.mountpoint.startswith("pv."): type = "lvmpv" kwargs["name"] = self.mountpoint - anaconda.id.ksdata.onPart[kwargs["name"]] = devicename + anaconda.ksdata.onPart[kwargs["name"]] = devicename if devicetree.getDeviceByName(kwargs["name"]): raise KickstartValueError, formatErrorMsg(self.lineno, msg="PV partition defined multiple times") @@ -818,13 +818,13 @@ class RaidData(commands.raid.F12_RaidData): dev.format.mountpoint = self.mountpoint dev.format.mountopts = self.fsopts - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) return # Get a list of all the RAID members. for member in self.members: # if member is using --onpart, use original device - member = anaconda.id.ksdata.onPart.get(member, member) + member = anaconda.ksdata.onPart.get(member, member) dev = devicetree.getDeviceByName(member) if not dev: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in RAID specification" % member) @@ -904,7 +904,7 @@ class RaidData(commands.raid.F12_RaidData): parents=request) storage.createDevice(luksdev) - anaconda.id.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) + anaconda.ksdata.skipSteps.extend(["partition", "zfcpconfig", "parttype"]) class RootPw(commands.rootpw.F8_RootPw): def execute(self, anaconda): @@ -919,7 +919,7 @@ class SELinux(commands.selinux.FC3_SELinux): class SkipX(commands.skipx.FC3_SkipX): def execute(self, anaconda): - anaconda.id.ksdata.skipSteps.extend(["setsanex", "videocard", "xcustom"]) + anaconda.ksdata.skipSteps.extend(["setsanex", "videocard", "xcustom"]) if anaconda.id.desktop is not None: anaconda.id.desktop.setDefaultRunLevel(3) @@ -951,7 +951,7 @@ class VolGroupData(commands.volgroup.FC3_VolGroupData): # Get a list of all the physical volume devices that make up this VG. for pv in self.physvols: # if pv is using --onpart, use original device - pv = anaconda.id.ksdata.onPart.get(pv, pv) + pv = anaconda.ksdata.onPart.get(pv, pv) dev = devicetree.getDeviceByName(pv) if not dev: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in Volume Group specification" % pv) @@ -1226,11 +1226,11 @@ def parseKickstart(anaconda, file): return handler def runPostScripts(anaconda): - if not anaconda.id.ksdata: + if not anaconda.ksdata: return postScripts = filter (lambda s: s.type == KS_SCRIPT_POST, - anaconda.id.ksdata.scripts) + anaconda.ksdata.scripts) if len(postScripts) == 0: return @@ -1271,12 +1271,12 @@ def runPreScripts(anaconda, scripts): def runTracebackScripts(anaconda): log.info("Running kickstart %%traceback script(s)") for script in filter (lambda s: s.type == KS_SCRIPT_TRACEBACK, - anaconda.id.ksdata.scripts): + anaconda.ksdata.scripts): script.run("/", flags.serial) log.info("All kickstart %%traceback script(s) have been run") def selectPackages(anaconda): - ksdata = anaconda.id.ksdata + ksdata = anaconda.ksdata ignoreAll = False # If no %packages header was seen, use the installclass's default group @@ -1356,7 +1356,7 @@ def setSteps(anaconda): len(packages.excludedList) > 0 or len(packages.excludedGroupList) > 0 dispatch = anaconda.dispatch - ksdata = anaconda.id.ksdata + ksdata = anaconda.ksdata interactive = ksdata.interactive.interactive if ksdata.upgrade.upgrade: @@ -266,7 +266,7 @@ def runRescue(anaconda, instClass): anaconda.intf = RescueInterface(screen) if anaconda.isKickstart: - if anaconda.id.ksdata.rescue and anaconda.id.ksdata.rescue.romount: + if anaconda.ksdata.rescue and anaconda.ksdata.rescue.romount: readOnly = 1 else: readOnly = 0 diff --git a/upgrade.py b/upgrade.py index 58960ec7b..6dd9d6ce4 100644 --- a/upgrade.py +++ b/upgrade.py @@ -64,8 +64,8 @@ def setUpgradeRoot(anaconda): anaconda.id.upgradeRoot = [] root_device = None # kickstart can pass device as device name or uuid. No quotes allowed. - if anaconda.isKickstart and anaconda.id.ksdata.upgrade.root_device is not None: - root_device = anaconda.id.ksdata.upgrade.root_device + if anaconda.isKickstart and anaconda.ksdata.upgrade.root_device is not None: + root_device = anaconda.ksdata.upgrade.root_device for (dev, label) in anaconda.id.rootParts: if ((root_device is not None) and (root_device == dev.name or root_device == "UUID=%s" % dev.format.uuid)): @@ -182,7 +182,7 @@ def upgradeMountFilesystems(anaconda): except IndexError as e: # The upgrade root is search earlier but we give the message here. log.debug("No upgrade root was found.") - if anaconda.isKickstart and anaconda.id.ksdata.upgrade.upgrade: + if anaconda.isKickstart and anaconda.ksdata.upgrade.upgrade: anaconda.intf.messageWindow(_("Upgrade root not found"), _("The root for the previously installed system was not " "found."), type="custom", diff --git a/yuminstall.py b/yuminstall.py index 300eb3728..75a11278b 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -673,7 +673,7 @@ class AnacondaYum(YumSorter): # This is the same pattern as from loader/urls.c:splitProxyParam. pattern = re.compile("([[:alpha:]]+://)?(([[:alnum:]]+)(:[^:@]+)?@)?([^:]+)(:[[:digit:]]+)?(/.*)?") - for ksrepo in self.anaconda.id.ksdata.repo.repoList: + for ksrepo in self.anaconda.ksdata.repo.repoList: anacondaBaseURLs = [ksrepo.baseurl] # yum doesn't understand nfs:// and doesn't want to. We need @@ -1403,7 +1403,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon # If %packages --ignoremissing was given, don't bother # prompting for missing dependencies. - if anaconda.isKickstart and anaconda.id.ksdata.packages.handleMissing == KS_MISSING_IGNORE: + if anaconda.isKickstart and anaconda.ksdata.packages.handleMissing == KS_MISSING_IGNORE: break if code == 1 and not anaconda.id.upgrade: @@ -1681,7 +1681,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon rpm.addMacro("__dbi_htconfig", "hash nofsync %{__dbi_other} %{__dbi_perms}") - if anaconda.isKickstart and anaconda.id.ksdata.packages.excludeDocs: + if anaconda.isKickstart and anaconda.ksdata.packages.excludeDocs: rpm.addMacro("_excludedocs", "1") cb = AnacondaCallback(self.ayum, anaconda, @@ -1868,7 +1868,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon def writePackagesKS(self, f, anaconda): if anaconda.isKickstart: - f.write(anaconda.id.ksdata.packages.__str__()) + f.write(anaconda.ksdata.packages.__str__()) return groups = [] |