From f11637c8d8ec9370a14284966be2f97de385b466 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 2 Dec 2009 15:41:55 -0500 Subject: 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. --- anaconda | 53 ++++++++++++++++++----------------------------------- backend.py | 5 ++--- booty/ppc.py | 15 +++++++-------- booty/sparc.py | 15 +++++++-------- exception.py | 13 ++++++------- firewall.py | 2 +- instdata.py | 9 +++------ iutil.py | 2 -- livecd.py | 3 --- packages.py | 9 +-------- security.py | 9 +++------ storage/fcoe.py | 2 +- storage/iscsi.py | 51 ++++++++++++++++++++++++--------------------------- text.py | 2 +- timezone.py | 4 ---- yuminstall.py | 9 --------- 16 files changed, 74 insertions(+), 129 deletions(-) diff --git a/anaconda b/anaconda index faa5544d8..ae83d7cb4 100755 --- a/anaconda +++ b/anaconda @@ -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) diff --git a/iutil.py b/iutil.py index c2cd9a3ce..5a09adb50 100644 --- a/iutil.py +++ b/iutil.py @@ -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): diff --git a/livecd.py b/livecd.py index aebdd711b..c3449f5c6 100644 --- a/livecd.py +++ b/livecd.py @@ -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: diff --git a/text.py b/text.py index f602986c2..08962ac80 100644 --- a/text.py +++ b/text.py @@ -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")) -- cgit