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

PATCH: remove duplicate installclass detection



In both anaconda and installclass.py the same code is used to detect
what install class to use. Also only one installclass with hidden=0
would be loaded.

This patch removes the duplicate code in anaconda and switches to using
the installclass with the highest priority.

Elliot

-- 
Elliot Peele
rPath, Inc.
elliot rpath com
919.851.3984 2117
diff -r 4e1b2f0a2367 anaconda
--- a/anaconda	Mon Mar 12 15:15:30 2007 -0500
+++ b/anaconda	Tue Mar 13 21:58:57 2007 -0400
@@ -354,21 +354,8 @@ def setupLoggingFromOpts(opts):
             logger.addSysLogHandler(log, opts.syslog)
 
 def getInstClass():
-    from installclass import DefaultInstall, availableClasses
-    retval = DefaultInstall(flags.expert)
-
-    allavail = availableClasses(showHidden = 1)
-    avail = availableClasses(showHidden = 0)
-    if len(avail) == 1:
-        (cname, cobject, clogo) = avail[0]
-        log.info("%s is only installclass, using it" %(cname,))
-        retval = cobject(flags.expert)
-    elif len(allavail) == 1:
-        (cname, cobject, clogo) = allavail[0]
-        log.info("%s is only installclass, using it" %(cname,))
-        retval = cobject(flags.expert)
-
-    return retval
+    from installclass import DefaultInstall
+    return DefaultInstall(flags.expert)
 
 # ftp installs pass the password via a file in /tmp so
 # ps doesn't show it
diff -r 4e1b2f0a2367 installclass.py
--- a/installclass.py	Mon Mar 12 15:15:30 2007 -0500
+++ b/installclass.py	Tue Mar 13 21:58:00 2007 -0400
@@ -577,15 +577,24 @@ def getBaseInstallClass():
     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
+
+    # Use the highest priority install class if more than one found.
+    elif len(avail) > 1:
+        (cname, cobject, clogo) = avail.pop()
+        log.info('%s is the highest priority installclass, using it' % cname)
+    elif len(allavail) > 1:
+        (cname, cobject, clogo) = allavail.pop()
+        log.info('%s is the highest priority installclass, using it' % cname)
+
+    # Default to the base installclass if nothing else is found.
     else:
         cobject = BaseInstallClass
         log.info("using baseinstallclass as base")
-        return BaseInstallClass
+
+    return cobject
 
 baseclass = getBaseInstallClass()
 

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