summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-03-17 11:28:51 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-03-18 09:21:50 -1000
commitbd18c5370cacbac9a88074d8b0b66f1824c9cdb7 (patch)
tree4fdd73fbadebc290aece1fb220bd676a6be4bd40
parente892c1599e9f8b2694a473bd709b0717aa5cb8b8 (diff)
downloadanaconda-bd18c5370cacbac9a88074d8b0b66f1824c9cdb7.tar.gz
anaconda-bd18c5370cacbac9a88074d8b0b66f1824c9cdb7.tar.xz
anaconda-bd18c5370cacbac9a88074d8b0b66f1824c9cdb7.zip
Use booleans in isys.mount() and isys.umount()
Use True/False over 1/0. It's the future.
-rw-r--r--image.py12
-rwxr-xr-xisys/isys.py7
-rw-r--r--livecd.py4
-rw-r--r--partedUtils.py6
-rw-r--r--rescue.py4
-rw-r--r--storage/__init__.py2
-rw-r--r--yuminstall.py10
7 files changed, 24 insertions, 21 deletions
diff --git a/image.py b/image.py
index 83e74dbb2..dea1e40d1 100644
--- a/image.py
+++ b/image.py
@@ -47,7 +47,7 @@ def findIsoImages(path, messageWindow):
try:
isys.mount("/dev/loop2", "/mnt/cdimage", fstype = "iso9660",
- readOnly = 1)
+ readOnly = True)
for num in range(1, 10):
if os.access("/mnt/cdimage/.discinfo", os.R_OK):
f = open("/mnt/cdimage/.discinfo")
@@ -95,7 +95,7 @@ def findIsoImages(path, messageWindow):
discImages[num] = file
- isys.umount("/mnt/cdimage", removeDir=0)
+ isys.umount("/mnt/cdimage", removeDir=False)
except SystemError:
pass
@@ -179,7 +179,7 @@ def mountImage(isodir, tree, discnum, messageWindow, discImages={}):
try:
isoImage = "%s/%s" % (isodir, discImages[discnum])
isys.losetup("/dev/loop1", isoImage, readOnly = 1)
- isys.mount("/dev/loop1", tree, fstype = 'iso9660', readOnly = 1);
+ isys.mount("/dev/loop1", tree, fstype = 'iso9660', readOnly = True);
break
except:
ans = messageWindow(_("Missing ISO 9660 Image"),
@@ -255,7 +255,7 @@ def scanForMedia(tree, storage):
continue
try:
- if isys.mount(dev.path, tree, fstype="iso9660", readOnly=1):
+ if isys.mount(dev.path, tree, fstype="iso9660", readOnly=True):
continue
except:
continue
@@ -270,7 +270,7 @@ def scanForMedia(tree, storage):
def umountImage(tree, currentMedia):
if currentMedia is not None:
- isys.umount(tree, removeDir=0)
+ isys.umount(tree, removeDir=False)
isys.unlosetup("/dev/loop1")
def unmountCD(path, messageWindow):
@@ -279,7 +279,7 @@ def unmountCD(path, messageWindow):
while True:
try:
- isys.umount(path, removeDir=0)
+ isys.umount(path, removeDir=False)
break
except Exception, e:
log.error("exception in _unmountCD: %s" %(e,))
diff --git a/isys/isys.py b/isys/isys.py
index d2168dbf1..1f4f22286 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -130,7 +130,7 @@ def ddfile(file, megs, pw = None):
os.close(fd)
## Mount a filesystem, similar to the mount system call.
-# @param device The device to mount. If bindMount is 1, this should be an
+# @param device The device to mount. If bindMount is True, this should be an
# already mounted directory. Otherwise, it should be a device
# name.
# @param location The path to mount device on.
@@ -141,7 +141,8 @@ def ddfile(file, megs, pw = None):
# @param bindMount Is this a bind mount? (see the mount(8) man page)
# @param remount Are we mounting an already mounted filesystem?
# @return The return value from the mount system call.
-def mount(device, location, fstype = "ext2", readOnly = 0, bindMount = 0, remount = 0, options = "defaults"):
+def mount(device, location, fstype = "ext2", readOnly = False,
+ bindMount = False, remount = False, options = "defaults"):
flags = None
location = os.path.normpath(location)
opts = string.split(options)
@@ -180,7 +181,7 @@ def mount(device, location, fstype = "ext2", readOnly = 0, bindMount = 0, remoun
# absolute path.
# @param removeDir Should the mount point be removed after being unmounted?
# @return The return value from the umount system call.
-def umount(what, removeDir = 1):
+def umount(what, removeDir = True):
what = os.path.normpath(what)
if not os.path.isdir(what):
diff --git a/livecd.py b/livecd.py
index 216b77eae..2d09717aa 100644
--- a/livecd.py
+++ b/livecd.py
@@ -140,7 +140,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
dirs.append("/selinux")
for dir in dirs:
try:
- isys.umount("%s/%s" %(anaconda.rootPath,dir), removeDir = 0)
+ isys.umount("%s/%s" %(anaconda.rootPath,dir), removeDir = False)
except Exception, e:
log.error("unable to unmount %s: %s" %(dir, e))
@@ -303,7 +303,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
isys.mount("/selinux", anaconda.rootPath + "/selinux", "selinuxfs")
except Exception, e:
log.error("error mounting selinuxfs: %s" %(e,))
- isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = 1)
+ isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = True)
wait.pop()
diff --git a/partedUtils.py b/partedUtils.py
index d0077f2b0..dde4d0b61 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -511,7 +511,8 @@ class DiskSet:
fs = isys.readFSType(theDev)
if fs is not None:
try:
- isys.mount(theDev, self.anaconda.rootPath, fs, readOnly = 1)
+ isys.mount(theDev, self.anaconda.rootPath, fs,
+ readOnly = True)
found = 1
except SystemError:
pass
@@ -557,7 +558,8 @@ class DiskSet:
fs = isys.readFSType(theDev)
if fs is not None:
try:
- isys.mount(theDev, self.anaconda.rootPath, fs, readOnly = 1)
+ isys.mount(theDev, self.anaconda.rootPath, fs,
+ readOnly = True)
found = 1
except SystemError:
pass
diff --git a/rescue.py b/rescue.py
index ffdd6a822..aeceb9803 100644
--- a/rescue.py
+++ b/rescue.py
@@ -329,10 +329,10 @@ def runRescue(anaconda, instClass):
log.error("Error enabling swap")
# now that dev is udev, bind mount the installer dev there
- isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = 1)
+ isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = True)
# and /dev/pts
- isys.mount("/dev/pts", "%s/dev/pts" %(anaconda.rootPath,), bindMount = 1)
+ isys.mount("/dev/pts", "%s/dev/pts" %(anaconda.rootPath,), bindMount = True)
# and /selinux too
if flags.selinux and os.path.isdir("%s/selinux" %(anaconda.rootPath,)):
diff --git a/storage/__init__.py b/storage/__init__.py
index 58f7fbf4f..ff5d99703 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1455,7 +1455,7 @@ class FSSet(object):
def umountFilesystems(self, instPath, ignoreErrors=True, swapoff=True):
# XXX if we tracked the /dev bind mount this wouln't be necessary
if os.path.ismount("%s/dev" % instPath):
- isys.umount("%s/dev" % instPath, removeDir=0)
+ isys.umount("%s/dev" % instPath, removeDir=False)
devices = self.mountpoints.values() + self.swapDevices
devices.extend([self.devshm, self.devpts, self.sysfs, self.proc])
diff --git a/yuminstall.py b/yuminstall.py
index a5de70225..19f31be4c 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -329,7 +329,7 @@ class AnacondaYum(YumSorter):
if self.currentMedia is None:
try:
isys.mount(self.anaconda.mediaDevice, self.tree,
- fstype="iso9660", readOnly=1)
+ fstype="iso9660", readOnly=True)
if verifyMedia(self.tree, discnum, None):
self.currentMedia = discnum
@@ -355,7 +355,7 @@ class AnacondaYum(YumSorter):
try:
isys.mount(self.anaconda.mediaDevice, self.tree,
- fstype = "iso9660", readOnly = 1)
+ fstype = "iso9660", readOnly = True)
if verifyMedia(self.tree, discnum, self._timestamp):
self.currentMedia = discnum
@@ -432,7 +432,7 @@ class AnacondaYum(YumSorter):
# install instead.
images = findIsoImages(self.tree, self.anaconda.intf.messageWindow)
if images != {}:
- isys.umount(self.tree, removeDir=0)
+ isys.umount(self.tree, removeDir=False)
self.anaconda.methodstr = "nfsiso:%s" % m[4:]
self.configBaseURL()
return
@@ -1367,7 +1367,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
if anaconda.dir == DISPATCH_BACK:
for d in ("/selinux", "/dev"):
try:
- isys.umount(anaconda.rootPath + d, removeDir = 0)
+ isys.umount(anaconda.rootPath + d, removeDir = False)
except Exception, e:
log.error("unable to unmount %s: %s" %(d, e))
return
@@ -1458,7 +1458,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
# handling /dev, it gets to be more fun. so just bind mount the
# installer /dev
log.warning("no dev package, going to bind mount /dev")
- isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = 1)
+ isys.mount("/dev", "%s/dev" %(anaconda.rootPath,), bindMount = True)
if not upgrade:
anaconda.id.storage.fsset.mkDevRoot(anaconda.rootPath)