diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | installclass.py | 32 | ||||
-rw-r--r-- | kickstart.py | 17 | ||||
-rw-r--r-- | upgradeclass.py | 10 |
4 files changed, 41 insertions, 25 deletions
@@ -1,5 +1,12 @@ 2006-08-10 Jeremy Katz <katzj@redhat.com> + * installclass.py (getBaseInstallClass): Add a method for finding + the default base install class so that I don't copy and paste the + code between kickstart and upgrade cases + * kickstart.py (Kickstart): Use getBaseInstallClass + * upgradeclass.py (InstallClass): Use proper base install + class (#201745) + * textw/confirm_text.py (BeginUpgradeWindow.__call__): Fix traceback (#201960) diff --git a/installclass.py b/installclass.py index c5d2d25aa..5518ebfa5 100644 --- a/installclass.py +++ b/installclass.py @@ -463,11 +463,6 @@ class BaseInstallClass: def __init__(self, expert): pass -# we need to be able to differentiate between this and custom -class DefaultInstall(BaseInstallClass): - def __init__(self, expert): - BaseInstallClass.__init__(self, expert) - allClasses = [] allClasses_hidden = [] @@ -549,3 +544,30 @@ def ordering(first, second): return 1 return 0 + +def getBaseInstallClass(): + # figure out what installclass we should base on. this is largely needed + # due to nonsense about how things like upgrades and kickstart are + # implemented as installclasses :/ + allavail = availableClasses(showHidden = 1) + avail = availableClasses(showHidden = 0) + if len(avail) == 1: + (cname, cobject, clogo) = avail[0] + log.info("using only installclass %s" %(cname,)) + return cobject + elif len(allavail) == 1: + (cname, cobject, clogo) = allavail[0] + log.info("using only installclass %s" %(cname,)) + return cobject + else: + cobject = BaseInstallClass + log.info("using baseinstallclass as base") + return BaseInstallClass + +baseclass = getBaseInstallClass() + +# we need to be able to differentiate between this and custom +class DefaultInstall(baseclass): + def __init__(self, expert): + BaseInstallClass.__init__(self, expert) + diff --git a/kickstart.py b/kickstart.py index 1040a46ac..efab62b58 100644 --- a/kickstart.py +++ b/kickstart.py @@ -720,22 +720,7 @@ class AnacondaKSParser(KickstartParser): self.handler.lineno = lineno self.handler.handlers[cmd](cmdArgs) -# figure out what installclass we should base on. if kickstart wasn't -# an installclass and was instead a data source, this nonsense wouldn't be -# needed -allavail = availableClasses(showHidden = 1) -avail = availableClasses(showHidden = 0) -if len(avail) == 1: - (cname, cobject, clogo) = avail[0] - log.info("%s is only installclass, using for kickstart" %(cname,)) -elif len(allavail) == 1: - (cname, cobject, clogo) = allavail[0] - log.info("%s is only installclass, using for kickstart" %(cname,)) - retval = cobject(flags.expert) -else: - cobject = BaseInstallClass - log.info("using baseinstallclass for kickstart") - +cobject = getBaseInstallClass() # The anaconda kickstart processor. class Kickstart(cobject): diff --git a/upgradeclass.py b/upgradeclass.py index 5ce350548..cad76c41f 100644 --- a/upgradeclass.py +++ b/upgradeclass.py @@ -9,14 +9,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -from installclass import BaseInstallClass +from installclass import getBaseInstallClass from rhpl.translate import N_, _ import os import iutil import rhpl -class InstallClass(BaseInstallClass): +baseclass = getBaseInstallClass() + +class InstallClass(baseclass): name = N_("Upgrade Existing System") pixmap = "upgrade.png" sortPriority = 999999 @@ -65,8 +67,8 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("upgbootloader") def setInstallData(self, anaconda): - BaseInstallClass.setInstallData(self, anaconda) + baseclass.setInstallData(self, anaconda) anaconda.id.setUpgrade(True) def __init__(self, expert): - BaseInstallClass.__init__(self, expert) + baseclass.__init__(self, expert) |