moved configuration handling to CryptoBoxSettings
added configuration validation updated unittests.CryptoBox for new configuration validation
This commit is contained in:
parent
0aa1f9f74b
commit
88fc900cc5
5 changed files with 281 additions and 134 deletions
|
@ -44,7 +44,7 @@ class CryptoBoxContainer:
|
|||
self.device = device
|
||||
self.cbox = cbox
|
||||
self.log = logging.getLogger("CryptoBox")
|
||||
self.Progs = self.cbox.cbxPrefs["Programs"]
|
||||
self.Progs = self.cbox.prefs["Programs"]
|
||||
self.__resetObject()
|
||||
|
||||
|
||||
|
@ -190,7 +190,7 @@ class CryptoBoxContainer:
|
|||
def_name = self.cbox.getNameForUUID(self.uuid)
|
||||
if def_name: return def_name
|
||||
"there is no name defined for this uuid - we will propose a good one"
|
||||
prefix = self.cbox.cbxPrefs["Main"]["DefaultVolumePrefix"]
|
||||
prefix = self.cbox.prefs["Main"]["DefaultVolumePrefix"]
|
||||
unused_found = False
|
||||
counter = 1
|
||||
while not unused_found:
|
||||
|
@ -293,7 +293,7 @@ class CryptoBoxContainer:
|
|||
|
||||
def __getMountPoint(self):
|
||||
"return the name of the mountpoint of this volume"
|
||||
return os.path.join(self.cbox.cbxPrefs["Locations"]["MountParentDir"], self.name)
|
||||
return os.path.join(self.cbox.prefs["Locations"]["MountParentDir"], self.name)
|
||||
|
||||
|
||||
def __mountLuks(self, password):
|
||||
|
@ -508,7 +508,7 @@ class CryptoBoxContainer:
|
|||
"luksFormat",
|
||||
self.device,
|
||||
"--batch-mode",
|
||||
"--cipher", self.cbox.cbxPrefs["Main"]["DefaultCipher"],
|
||||
"--cipher", self.cbox.prefs["Main"]["DefaultCipher"],
|
||||
"--iter-time", "2000"])
|
||||
proc.stdin.write(password)
|
||||
(output, errout) = proc.communicate()
|
||||
|
@ -559,9 +559,9 @@ class CryptoBoxContainer:
|
|||
def __cleanMountDirs(self):
|
||||
""" remove all unnecessary subdirs of the mount parent directory
|
||||
this should be called for every (u)mount """
|
||||
subdirs = os.listdir(self.cbox.cbxPrefs["Locations"]["MountParentDir"])
|
||||
subdirs = os.listdir(self.cbox.prefs["Locations"]["MountParentDir"])
|
||||
for dir in subdirs:
|
||||
abs_dir = os.path.join(self.cbox.cbxPrefs["Locations"]["MountParentDir"], dir)
|
||||
abs_dir = os.path.join(self.cbox.prefs["Locations"]["MountParentDir"], dir)
|
||||
if (not os.path.islink(abs_dir)) and os.path.isdir(abs_dir) and (not os.path.ismount(abs_dir)):
|
||||
os.rmdir(abs_dir)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue