[master 2/4] Moving anaconda.rootPath to constants.ROOT_PATH, Part 1.

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

 



Creating the constant, removing the old variable and fixing
references that can not be renamed mechanically.

This way we don't have to pass anaconda around when we only need
'/mnt/sysimage'.
---
 pyanaconda/__init__.py         |   26 +++++++++++++-------------
 pyanaconda/constants.py        |    1 +
 pyanaconda/storage/__init__.py |   10 ++++------
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 5ba37a3..62acb64 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -31,6 +31,7 @@
 import os, time, string
 import iutil
 import isys
+from constants import *
 from tempfile import mkstemp
 
 import logging
@@ -74,7 +75,6 @@ class Anaconda(object):
         self.rescue = False
         self.rescue_mount = True
         self.rootParts = None
-        self.rootPath = "/mnt/sysimage"
         self.security = security.Security()
         self.simpleFilter = not iutil.isS390()
         self.stage2 = None
@@ -193,7 +193,7 @@ class Anaconda(object):
         if not self._timezone:
             import timezone
             self._timezone = timezone.Timezone()
-            self._timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone(self.rootPath))
+            self._timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone(ROOT_PATH))
 
         return self._timezone
 
@@ -263,7 +263,7 @@ class Anaconda(object):
         if self.xdriver is None:
             return
         if root is None:
-            root = self.rootPath
+            root = ROOT_PATH
         if not os.path.isdir("%s/etc/X11" %(root,)):
             os.makedirs("%s/etc/X11" %(root,), mode=0755)
         f = open("%s/etc/X11/xorg.conf" %(root,), 'w')
@@ -287,17 +287,17 @@ class Anaconda(object):
 
     def write(self):
         self.writeXdriver()
-        self.instLanguage.write(self.rootPath)
+        self.instLanguage.write(ROOT_PATH)
 
-        self.timezone.write(self.rootPath)
+        self.timezone.write(ROOT_PATH)
         self.network.write()
-        self.network.copyConfigToPath(instPath=self.rootPath)
+        self.network.copyConfigToPath(instPath=ROOT_PATH)
         self.network.disableNMForStorageDevices(self,
-                                                instPath=self.rootPath)
-        self.desktop.write(self.rootPath)
-        self.users.write(self.rootPath)
-        self.security.write(self.rootPath)
-        self.firewall.write(self.rootPath)
+                                                instPath=ROOT_PATH)
+        self.desktop.write(ROOT_PATH)
+        self.users.write(ROOT_PATH)
+        self.security.write(ROOT_PATH)
+        self.firewall.write(ROOT_PATH)
 
         services = list(self.storage.services)
 
@@ -306,7 +306,7 @@ class Anaconda(object):
                 iutil.execWithRedirect("/sbin/chkconfig",
                                        [svc, "off"],
                                        stdout="/dev/tty5", stderr="/dev/tty5",
-                                       root=self.rootPath)
+                                       root=ROOT_PATH)
 
             services.extend(self.ksdata.services.enabled)
 
@@ -314,7 +314,7 @@ class Anaconda(object):
             iutil.execWithRedirect("/sbin/chkconfig",
                                    [svc, "on"],
                                    stdout="/dev/tty5", stderr="/dev/tty5",
-                                   root=self.rootPath)
+                                   root=ROOT_PATH)
 
     def writeKS(self, filename):
         import urllib
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index 3197914..cb25e69 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -103,3 +103,4 @@ relabelDirs  = ["/etc/sysconfig/network-scripts", "/var/lib/rpm", "/var/lib/yum"
                 "/var/log", "/etc/modprobe.d", "/etc/sysconfig", "/var/cache/yum" ]
 
 ANACONDA_CLEANUP = "anaconda-cleanup"
+ROOT_PATH = "/mnt/sysimage"
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index abfdb55..26a3d86 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -376,7 +376,7 @@ class Storage(object):
                                      luksDict=self.__luksDevs,
                                      iscsi=self.iscsi,
                                      dasd=self.dasd)
-        self.fsset = FSSet(self.devicetree, getattr(anaconda, "rootPath", ""))
+        self.fsset = FSSet(self.devicetree, ROOT_PATH)
         self.services = set()
 
     def doIt(self):
@@ -473,8 +473,7 @@ class Storage(object):
         self.devicetree.populate(progressWindow=prog,
                                  cleanupOnly=cleanupOnly)
         self.config.clearPartType = clearPartType # set it back
-        self.fsset = FSSet(self.devicetree,
-                           getattr(self.anaconda, "rootPath", ""))
+        self.fsset = FSSet(self.devicetree, ROOT_PATH)
         self.eddDict = get_edd_dict(self.partitioned)
         if hasattr(self.anaconda, "rootParts") and \
            hasattr(self.anaconda, "upgradeRoot"):
@@ -1302,13 +1301,12 @@ class Storage(object):
 
     def turnOnSwap(self, upgrading=None):
         self.fsset.turnOnSwap(intf=self.intf,
-                              rootPath=getattr(self.anaconda, "rootPath", ""),
+                              rootPath=ROOT_PATH,
                               upgrading=upgrading)
 
     def mountFilesystems(self, raiseErrors=None, readOnly=None, skipRoot=False):
         self.fsset.mountFilesystems(intf=self.intf,
-                                    rootPath=getattr(self.anaconda,
-                                                     "rootPath", ""),
+                                    rootPath=ROOT_PATH,
                                     raiseErrors=raiseErrors,
                                     readOnly=readOnly, skipRoot=skipRoot)
 
-- 
1.7.6

_______________________________________________
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