diff options
author | Chris Lumens <clumens@redhat.com> | 2009-12-02 15:41:55 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-12-03 13:14:43 -0500 |
commit | f11637c8d8ec9370a14284966be2f97de385b466 (patch) | |
tree | 10ba1bb25bc2230c78f62f100947f13bde45cfe3 | |
parent | 9581135046aa223a9374b3d0fd19eba3d46051b3 (diff) | |
download | anaconda-f11637c8d8ec9370a14284966be2f97de385b466.tar.gz anaconda-f11637c8d8ec9370a14284966be2f97de385b466.tar.xz anaconda-f11637c8d8ec9370a14284966be2f97de385b466.zip |
Remove test mode.
This is yet another way of running anaconda that gets extremely limited use,
no testing, and no consideration during development to making sure it still
works. Again, we need to stop pretending and get rid of modes that we don't
support.
-rwxr-xr-x | anaconda | 53 | ||||
-rw-r--r-- | backend.py | 5 | ||||
-rw-r--r-- | booty/ppc.py | 15 | ||||
-rw-r--r-- | booty/sparc.py | 15 | ||||
-rw-r--r-- | exception.py | 13 | ||||
-rw-r--r-- | firewall.py | 2 | ||||
-rw-r--r-- | instdata.py | 9 | ||||
-rw-r--r-- | iutil.py | 2 | ||||
-rw-r--r-- | livecd.py | 3 | ||||
-rw-r--r-- | packages.py | 9 | ||||
-rw-r--r-- | security.py | 9 | ||||
-rw-r--r-- | storage/fcoe.py | 2 | ||||
-rw-r--r-- | storage/iscsi.py | 51 | ||||
-rw-r--r-- | text.py | 2 | ||||
-rw-r--r-- | timezone.py | 4 | ||||
-rw-r--r-- | yuminstall.py | 9 |
16 files changed, 74 insertions, 129 deletions
@@ -71,7 +71,7 @@ def startMiniWM(root='/'): def doStartupX11Actions(runres="800x600"): global miniwm_pid - if not flags.test and flags.setupFilesystems: + if flags.setupFilesystems: setupGraphicalLinks() # now start up mini-wm @@ -184,7 +184,6 @@ def parseOptions(): op.add_option("-d", "--debug", dest="debug", action="store_true", default=False) op.add_option("--kickstart", dest="ksfile") op.add_option("--rescue", dest="rescue", action="store_true", default=False) - op.add_option("-t", "--test", action="store_true", default=False) op.add_option("--targetarch", dest="targetArch", nargs=1, type="string") op.add_option("-m", "--method", dest="method", default=None) @@ -237,26 +236,20 @@ def parseOptions(): return op.parse_args() def setupPythonPath(): - # For anaconda in test mode - if (os.path.exists('isys')): - sys.path.insert(0, 'isys') - sys.path.insert(0, 'textw') - sys.path.insert(0, 'iw') + haveUpdates = False + for ndx in range(len(sys.path)-1, -1, -1): + if sys.path[ndx].endswith('updates'): + haveUpdates = True + break + + if haveUpdates: + sys.path.insert(ndx+1, '/usr/lib/anaconda') + sys.path.insert(ndx+2, '/usr/lib/anaconda/textw') + sys.path.insert(ndx+3, '/usr/lib/anaconda/iw') else: - haveUpdates = False - for ndx in range(len(sys.path)-1, -1, -1): - if sys.path[ndx].endswith('updates'): - haveUpdates = True - break - - if haveUpdates: - sys.path.insert(ndx+1, '/usr/lib/anaconda') - sys.path.insert(ndx+2, '/usr/lib/anaconda/textw') - sys.path.insert(ndx+3, '/usr/lib/anaconda/iw') - else: - sys.path.insert(0, '/usr/lib/anaconda') - sys.path.insert(1, '/usr/lib/anaconda/textw') - sys.path.insert(2, '/usr/lib/anaconda/iw') + sys.path.insert(0, '/usr/lib/anaconda') + sys.path.insert(1, '/usr/lib/anaconda/textw') + sys.path.insert(2, '/usr/lib/anaconda/iw') sys.path.append('/usr/share/system-config-date') @@ -333,11 +326,7 @@ def expandFTPMethod(str): return None def runVNC(): - # dont run vncpassword if in test mode global vncS - if flags.test: - vncS.password = "" - vncS.startServer() child = os.fork() @@ -376,7 +365,7 @@ def checkMemory(opts): sys.exit(0) # override display mode if machine cannot nicely run X - if not flags.test and not flags.usevnc: + if not flags.usevnc: if opts.display_mode not in ('t', 'c') and iutil.memInstalled() < isys.MIN_GUI_RAM: stdoutLog.warning(_("You do not have enough RAM to use the graphical " "installer. Starting text mode.")) @@ -506,8 +495,6 @@ class Anaconda: from gui import InstallInterface except Exception, e: stdoutLog.error("Exception starting GUI installer: %s" %(e,)) - if flags.test: - sys.exit(1) # if we're not going to really go into GUI mode, we need to get # back to vc1 where the text install is going to pop up. if not x_already_set: @@ -704,10 +691,6 @@ if __name__ == "__main__": (path, name) = string.split(mod, ":") extraModules.append((path, name)) - if opts.test: - flags.test = 1 - flags.setupFilesystems = 0 - if opts.vnc: flags.usevnc = 1 opts.display_mode = 'g' @@ -748,8 +731,8 @@ if __name__ == "__main__": if iutil.isS390(): opts.isHeadless = True - if not flags.test and not flags.livecdInstall: - isys.auditDaemon() + if not flags.livecdInstall: + isys.auditDaemon() # setup links required for all install types for i in ( "services", "protocols", "nsswitch.conf", "joe", "selinux", @@ -883,7 +866,7 @@ if __name__ == "__main__": # now determine if we're going to run in GUI or TUI mode # # if no X server, we have to use text mode - if not (flags.test or x_already_set) and (not iutil.isS390() and not os.access("/usr/bin/Xorg", os.X_OK)): + if not x_already_set and (not iutil.isS390() and not os.access("/usr/bin/Xorg", os.X_OK)): stdoutLog.warning(_("Graphical installation is not available. " "Starting text mode.")) time.sleep(2) diff --git a/backend.py b/backend.py index fcd357144..08e3ce7b3 100644 --- a/backend.py +++ b/backend.py @@ -301,6 +301,5 @@ def doBasePackageSelect(anaconda): def writeConfiguration(anaconda): log.info("Writing main configuration") - if not flags.test: - anaconda.id.write() - anaconda.backend.writeConfiguration() + anaconda.id.write() + anaconda.backend.writeConfiguration() diff --git a/booty/ppc.py b/booty/ppc.py index e19e5d610..f8ace149e 100644 --- a/booty/ppc.py +++ b/booty/ppc.py @@ -141,14 +141,13 @@ class ppcBootloaderInfo(bootloaderInfo): ybinargs = [ yabootProg, "-f", "-C", cf ] - if not flags.test: - rc = iutil.execWithRedirect(ybinargs[0], - ybinargs[1:], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - root = instRoot) - if rc: - return rc + rc = iutil.execWithRedirect(ybinargs[0], + ybinargs[1:], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + root = instRoot) + if rc: + return rc if (not os.access(instRoot + "/etc/yaboot.conf", os.R_OK) and os.access(instRoot + "/boot/etc/yaboot.conf", os.R_OK)): diff --git a/booty/sparc.py b/booty/sparc.py index 22c4ab8b7..276eafd8f 100644 --- a/booty/sparc.py +++ b/booty/sparc.py @@ -93,14 +93,13 @@ class sparcBootloaderInfo(bootloaderInfo): else: sbinargs += ["-U"] - if not flags.test: - rc = iutil.execWithRedirect(sbinargs[0], - sbinargs[1:], - stdout = "/dev/tty5", - stderr = "/dev/tty5", - root = instRoot) - if rc: - return rc + rc = iutil.execWithRedirect(sbinargs[0], + sbinargs[1:], + stdout = "/dev/tty5", + stderr = "/dev/tty5", + root = instRoot) + if rc: + return rc if (not os.access(instRoot + "/etc/silo.conf", os.R_OK) and os.access(instRoot + "/boot/etc/silo.conf", os.R_OK)): diff --git a/exception.py b/exception.py index b6356ad39..60119b2ed 100644 --- a/exception.py +++ b/exception.py @@ -69,13 +69,12 @@ class AnacondaExceptionHandler(ExceptionHandler): os.kill(int(pid), signal.SIGKILL) pf.close() - if not flags.test: - os.open("/dev/console", os.O_RDWR) # reclaim stdin - os.dup2(0, 1) # reclaim stdout - os.dup2(0, 2) # reclaim stderr - # ^ - # | - # +------ dup2 is magic, I tells ya! + os.open("/dev/console", os.O_RDWR) # reclaim stdin + os.dup2(0, 1) # reclaim stdout + os.dup2(0, 2) # reclaim stderr + # ^ + # | + # +------ dup2 is magic, I tells ya! # bring back the echo import termios diff --git a/firewall.py b/firewall.py index 56dcb5d6b..750d75538 100644 --- a/firewall.py +++ b/firewall.py @@ -74,7 +74,7 @@ class Firewall: args = [ "--quiet", "--nostart", "-f" ] + self.getArgList() try: - if not flags.test and not os.path.exists("%s/etc/sysconfig/iptables" %(instPath,)): + if not os.path.exists("%s/etc/sysconfig/iptables" %(instPath,)): iutil.execWithRedirect("/usr/sbin/lokkit", args, root=instPath, stdout="/dev/null", stderr="/dev/null") diff --git a/instdata.py b/instdata.py index 2e1503d3a..794f5be68 100644 --- a/instdata.py +++ b/instdata.py @@ -143,12 +143,9 @@ class InstallData: args = ["--update", "--nostart"] + shlex.split(self.auth) try: - if not flags.test: - iutil.execWithRedirect("/usr/sbin/authconfig", args, - stdout = "/dev/tty5", stderr = "/dev/tty5", - root = self.anaconda.rootPath) - else: - log.error("Would have run: %s", args) + iutil.execWithRedirect("/usr/sbin/authconfig", args, + stdout = "/dev/tty5", stderr = "/dev/tty5", + root = self.anaconda.rootPath) except RuntimeError, msg: log.error("Error running %s: %s", args, msg) @@ -668,8 +668,6 @@ def isEfi(): def writeRpmPlatform(root="/"): import rpmUtils.arch - if flags.test: - return if os.access("%s/etc/rpm/platform" %(root,), os.R_OK): return if not os.access("%s/etc/rpm" %(root,), os.X_OK): @@ -175,9 +175,6 @@ class LiveCDCopyBackend(backend.AnacondaBackend): def doInstall(self, anaconda): log.info("Preparing to install packages") - if flags.test: - log.info("Test mode - not performing install") - return progress = anaconda.id.instProgress progress.set_label(_("Copying live image to hard drive.")) diff --git a/packages.py b/packages.py index 03d27fbb8..61faede81 100644 --- a/packages.py +++ b/packages.py @@ -61,10 +61,7 @@ def firstbootConfiguration(anaconda): def writeKSConfiguration(anaconda): log.info("Writing autokickstart file") - if not flags.test: - fn = anaconda.rootPath + "/root/anaconda-ks.cfg" - else: - fn = "/tmp/anaconda-ks.cfg" + fn = anaconda.rootPath + "/root/anaconda-ks.cfg" anaconda.id.writeKS(fn) @@ -191,10 +188,6 @@ def setupTimezone(anaconda): if anaconda.id.upgrade or anaconda.dir == DISPATCH_BACK: return - # dont do this in test mode! - if flags.test: - return - os.environ["TZ"] = anaconda.id.timezone.tz tzfile = "/usr/share/zoneinfo/" + anaconda.id.timezone.tz tzlocalfile = "/etc/localtime" diff --git a/security.py b/security.py index bd5c9da32..5e5928e1b 100644 --- a/security.py +++ b/security.py @@ -64,12 +64,9 @@ class Security: args = args + [ "--selinux=%s" %(selinux_states[self.selinux],) ] try: - if not flags.test: - iutil.execWithRedirect("/usr/sbin/lokkit", args, - root = instPath, stdout = "/dev/null", - stderr = "/dev/null") - else: - log.info("would have run %s" %(args,)) + iutil.execWithRedirect("/usr/sbin/lokkit", args, + root = instPath, stdout = "/dev/null", + stderr = "/dev/null") except RuntimeError, msg: log.error ("lokkit run failed: %s" %(msg,)) except OSError as e: diff --git a/storage/fcoe.py b/storage/fcoe.py index 18c60be9b..906c8c013 100644 --- a/storage/fcoe.py +++ b/storage/fcoe.py @@ -122,7 +122,7 @@ class fcoe(object): return def write(self, instPath, anaconda): - if flags.test or not self.nics: + if not self.nics: return if not os.path.isdir(instPath + "/etc/fcoe"): diff --git a/storage/iscsi.py b/storage/iscsi.py index 75d3d02e0..e5e696a7e 100644 --- a/storage/iscsi.py +++ b/storage/iscsi.py @@ -263,33 +263,30 @@ class iscsi(object): if not self.initiatorSet: return - if not flags.test: - root = anaconda.id.storage.rootDevice - - # set iscsi nodes to autostart - for node in self.nodes: - autostart = True - disks = self.getNodeDisks(node, anaconda.id.storage) - for disk in disks: - # nodes used for root get started by the initrd - if root.dependsOn(disk): - autostart = False - - if autostart: - node.setParameter("node.startup", "automatic") - - if not os.path.isdir(instPath + "/etc/iscsi"): - os.makedirs(instPath + "/etc/iscsi", 0755) - fd = os.open(instPath + INITIATOR_FILE, os.O_RDWR | os.O_CREAT) - os.write(fd, "InitiatorName=%s\n" %(self.initiator)) - os.close(fd) - - # copy "db" files. *sigh* - if os.path.isdir(instPath + "/var/lib/iscsi"): - shutil.rmtree(instPath + "/var/lib/iscsi") - if os.path.isdir("/var/lib/iscsi"): - shutil.copytree("/var/lib/iscsi", instPath + "/var/lib/iscsi", - symlinks=True) + # set iscsi nodes to autostart + for node in self.nodes: + autostart = True + disks = self.getNodeDisks(node, anaconda.id.storage) + for disk in disks: + # nodes used for root get started by the initrd + if root.dependsOn(disk): + autostart = False + + if autostart: + node.setParameter("node.startup", "automatic") + + if not os.path.isdir(instPath + "/etc/iscsi"): + os.makedirs(instPath + "/etc/iscsi", 0755) + fd = os.open(instPath + INITIATOR_FILE, os.O_RDWR | os.O_CREAT) + os.write(fd, "InitiatorName=%s\n" %(self.initiator)) + os.close(fd) + + # copy "db" files. *sigh* + if os.path.isdir(instPath + "/var/lib/iscsi"): + shutil.rmtree(instPath + "/var/lib/iscsi") + if os.path.isdir("/var/lib/iscsi"): + shutil.copytree("/var/lib/iscsi", instPath + "/var/lib/iscsi", + symlinks=True) def getNode(self, name, address, port): for node in self.nodes: @@ -469,7 +469,7 @@ class InstallInterface: self.screen.suspendCallback(spawnShell, self.screen) # drop into the python debugger on ctrl-z if we're running in test mode - if flags.debug or flags.test: + if flags.debug: self.screen.suspendCallback(debugSelf, self.screen) self.instLanguage = anaconda.id.instLanguage diff --git a/timezone.py b/timezone.py index 4b2dfbe67..74d66db7f 100644 --- a/timezone.py +++ b/timezone.py @@ -33,10 +33,6 @@ class Timezone: f.write(" %s\n" % self.tz) def write(self, instPath): - # dont do this in test mode! - if flags.test: - return - fromFile = instPath + "/usr/share/zoneinfo/" + self.tz if not os.access(fromFile, os.R_OK): diff --git a/yuminstall.py b/yuminstall.py index 67c3d62fa..a0c7203d3 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1473,9 +1473,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon log.error("unable to unmount %s: %s" %(d, e)) return - if flags.test: - return - # shorthand upgrade = anaconda.id.getUpgrade() @@ -1655,9 +1652,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon def doInstall(self, anaconda): log.info("Preparing to install packages") - if flags.test: - log.info("Test mode - not performing install") - return if not anaconda.id.upgrade: rpm.addMacro("__dbi_htconfig", @@ -1684,9 +1678,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon return DISPATCH_BACK def doPostInstall(self, anaconda): - if flags.test: - return - if anaconda.id.getUpgrade(): w = anaconda.intf.waitWindow(_("Post Upgrade"), _("Performing post-upgrade configuration")) |