summaryrefslogtreecommitdiffstats
path: root/fsset.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-10-30 19:26:32 +0000
committerMatt Wilson <msw@redhat.com>2001-10-30 19:26:32 +0000
commit5bd05c6b42b7a09bfec5ef1e8a58e6527fe6cc11 (patch)
tree84f86268e277661242bff8eb961a7c37d1b4a912 /fsset.py
parent607e0fd8bacb9feb9350a62f322900404e0e7b55 (diff)
downloadanaconda-5bd05c6b42b7a09bfec5ef1e8a58e6527fe6cc11.tar.gz
anaconda-5bd05c6b42b7a09bfec5ef1e8a58e6527fe6cc11.tar.xz
anaconda-5bd05c6b42b7a09bfec5ef1e8a58e6527fe6cc11.zip
use startswith
Diffstat (limited to 'fsset.py')
-rw-r--r--fsset.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/fsset.py b/fsset.py
index cbe7d638e..eef692af7 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1331,7 +1331,7 @@ class LoopbackDevice(Device):
return "# LOOP1: %s %s /redhat.img\n" % (self.host, self.hostfs)
def makeDevice(dev):
- if dev[:2] == "md":
+ if dev.startswith('md'):
try:
mdname, devices, level, numActive = \
partitioning.lookup_raid_device(dev)
@@ -1377,12 +1377,12 @@ def readFstab (path):
# pick up the magic comment in fstab that tells us which
# device is the loop host in a partionless upgrade
- if fields[0] == "#" and len(fields) > 4 and fields[1][:4] == "LOOP":
+ if fields[0] == "#" and fields[1].startswith("LOOP"):
device = string.lower(fields[1])
if device[len(device) - 1] == ":":
device = device[:len(device) - 1]
realDevice = fields[2]
- if realDevice[:5] == "/dev/":
+ if realDevice.startswith('/dev/'):
realDevice = realDevice[5:]
loopIndex[device] = (realDevice, fields[3])
@@ -1404,7 +1404,7 @@ def readFstab (path):
if fields[0] == "none":
device = Device()
- elif len(fields) >= 6 and fields[0][:6] == "LABEL=":
+ elif len(fields) >= 6 and fields[0].startswith('LABEL='):
label = fields[0][6:]
if labelToDevice.has_key(label):
device = makeDevice(labelToDevice[label])
@@ -1413,23 +1413,23 @@ def readFstab (path):
"could not be found on any filesystem", label)
# bad luck, skip this entry.
continue
- elif (fields[2] == "swap" and fields[0][:5] != "/dev/"):
+ elif (fields[2] == "swap" and not fields[0].startswith('/dev/')[:5]):
# swap files
file = fields[0]
- if file[:15] == "/initrd/loopfs/":
+ if file.startswith('/initrd/loopfs/'):
file = file[14:]
device = PiggybackSwapFileDevice("/mnt/loophost", file)
else:
device = SwapFileDevice(file)
- elif fields[0][:9] == "/dev/loop":
+ elif fields[0].startswith('/dev/loop'):
# look up this loop device in the index to find the
# partition that houses the filesystem image
# XXX currently we assume /dev/loop1
if loopIndex.has_key(device):
(dev, fs) = loopIndex[device]
device = LoopbackDevice(dev, fs)
- elif fields[0][:5] == "/dev/":
+ elif fields[0].startswith('/dev/'):
device = makeDevice(fields[0][5:])
else:
continue