summaryrefslogtreecommitdiffstats
path: root/cryptodev.py
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2008-03-20 12:12:03 -0500
committerDavid Lehman <dlehman@redhat.com>2008-03-26 12:52:56 -0500
commitffb45a463d7d3534d51c1f47a155c9e74d255330 (patch)
treed9062d7134fab40535e9f77a4f2110c548b57ae0 /cryptodev.py
parent86cedf61d6c892e7c9a28b48156890c461bd9f96 (diff)
downloadanaconda-ffb45a463d7d3534d51c1f47a155c9e74d255330.tar.gz
anaconda-ffb45a463d7d3534d51c1f47a155c9e74d255330.tar.xz
anaconda-ffb45a463d7d3534d51c1f47a155c9e74d255330.zip
Put in some handling for redundant method calls and devices containing '/'.
Diffstat (limited to 'cryptodev.py')
-rw-r--r--cryptodev.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cryptodev.py b/cryptodev.py
index 2cd14d784..080d198b6 100644
--- a/cryptodev.py
+++ b/cryptodev.py
@@ -62,10 +62,16 @@ class LUKSDevice:
return self.scheme
def setDevice(self, device):
+ if self._device == device:
+ return
+
self._device = device
if device is not None:
+ if device.startswith("/dev/"):
+ device = device[5:]
+
name = "%s-%s" % (self.scheme.lower(),
- os.path.basename(device))
+ device.replace("/", "-"))
self.setName(name)
def getDevice(self, encrypted=0):
@@ -78,6 +84,9 @@ class LUKSDevice:
def setName(self, name, lock=False):
"""Set the name of the mapped device, eg: 'dmcrypt-sda3'"""
+ if self.name == name:
+ return
+
if self.name and not self.getStatus():
raise RuntimeError, "Cannot rename an active mapping."