[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/7] Allow creation of LUKSDevice with no passphrase.



The hack in getScheme for autopart causes a traceback if a LUKSdevice is created without a passphrase, which is something that makes sense to do when discovering existing devices. So we just use the "scheme" data member internally as a workaround.

Also, make sure all return values from openDevice are numeric.
---
 cryptodev.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cryptodev.py b/cryptodev.py
index 39f3fd9..2cd14d7 100644
--- a/cryptodev.py
+++ b/cryptodev.py
@@ -64,7 +64,7 @@ class LUKSDevice:
     def setDevice(self, device):
         self._device = device
         if device is not None:
-            name = "%s-%s" % (self.getScheme().lower(),
+            name = "%s-%s" % (self.scheme.lower(),
                               os.path.basename(device))
             self.setName(name)
 
@@ -149,7 +149,7 @@ class LUKSDevice:
     def openDevice(self):
         if not self.getStatus():
             # already mapped
-            return
+            return 0
 
         if not self.passphrase:
             raise RuntimeError, "Cannot create mapping without a passphrase."
-- 
1.5.3.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]