FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 12-02-2009, 08:30 PM
Chris Lumens
 
Default 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 | 54 ++++++++++++++++++------------------------------------
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(+), 130 deletions(-)

diff --git a/anaconda b/anaconda
index d4c004a..cc8f7ec 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,8 +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)
op.add_option("--repo", dest="method", default=None)
@@ -237,26 +235,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')

@@ -331,11 +323,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()
@@ -374,7 +362,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."))
@@ -504,8 +492,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:
@@ -701,10 +687,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'
@@ -745,8 +727,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",
@@ -880,7 +862,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 fcd3571..08e3ce7 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 e19e5d6..f8ace14 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 22c4ab8..276eafd 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 b6356ad..60119b2 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 56dcb5d..750d755 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 2e1503d..794f5be 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 82a8f9a..d33c5ad 100644
--- a/iutil.py
+++ b/iutil.py
@@ -669,8 +669,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 aebdd71..c3449f5 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 ba345aa..a298b55 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
if not os.access(tzfile, os.R_OK):
diff --git a/security.py b/security.py
index bd5c9da..5e5928e 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 18c60be..906c8c0 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 75d3d02..e5e696a 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
" %(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
" %(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 f602986..08962ac 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 4b2dfbe..74d66db 100644
--- a/timezone.py
+++ b/timezone.py
@@ -33,10 +33,6 @@ class Timezone:
f.write(" %s
" % 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 2ffeba9..101a046 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1469,9 +1469,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()

@@ -1651,9 +1648,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",
@@ -1680,9 +1674,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"))
--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 12-02-2009, 08:36 PM
Bill Nottingham
 
Default Remove test mode.

Chris Lumens (clumens@redhat.com) said:
> 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.

This looks incomplete - there's loader test code as well.

Maybe I'm weird, but I've used test mode to avoid spinning a full install
image recently.

Bill

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 02:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org