[PATCH] Add all possible install class locations to the search path (#587696).

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

 



RHEL6 install classes inherit from each other.  In order for anaconda to import
a subclass, it's going to have to have the location of the subclass in the path
too.

Also, fix the base RHEL install class's name so we don't get an import error.
---
 installclass.py        |   21 +++++++++++----------
 installclasses/rhel.py |    2 +-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/installclass.py b/installclass.py
index 6756405..deb7e53 100644
--- a/installclass.py
+++ b/installclass.py
@@ -245,20 +245,21 @@ def availableClasses(showHidden=0):
     else:
         if allClasses_hidden: return allClasses_hidden
 
-    if os.access("installclasses", os.R_OK):
-	path = "installclasses"
-    elif os.access("/tmp/updates/installclasses", os.R_OK):
-        path = "/tmp/updates/installclasses"
-    elif os.access("/tmp/product/installclasses", os.R_OK):
-        path = "/tmp/product/installclasses"
-    else:
-	path = "/usr/lib/anaconda/installclasses"
+    path = []
+
+    for dir in ["installclasses", "/tmp/updates/installclasses",
+                "/tmp/product/installclasses", "/usr/lib/anaconda/installclasses"]:
+        if os.access(dir, os.R_OK):
+            path.append(dir)
 
     # append the location of installclasses to the python path so we
     # can import them
-    sys.path.insert(0, path)
+    sys.path = path + sys.path
+
+    files = []
+    for p in reversed(path):
+        files += os.listdir(p)
 
-    files = os.listdir(path)
     done = {}
     list = []
     for file in files:
diff --git a/installclasses/rhel.py b/installclasses/rhel.py
index 7aaf356..46dfca8 100644
--- a/installclasses/rhel.py
+++ b/installclasses/rhel.py
@@ -27,7 +27,7 @@ import types
 import installmethod
 import yuminstall
 
-class RHELInstallClass(BaseInstallClass):
+class InstallClass(BaseInstallClass):
     # name has underscore used for mnemonics, strip if you dont need it
     id = "rhel"
     name = N_("Red Hat Enterprise Linux")
-- 
1.7.0.1

_______________________________________________
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