Fixed integration issue with cryptsetup; unit tests now pass

This commit is contained in:
frisco 2009-05-25 02:37:15 +00:00
parent 7032d06020
commit 9add2a7b34
4 changed files with 12 additions and 14 deletions

1
bin/cryptobox.conf Symbolic link
View File

@ -0,0 +1 @@
cryptobox-unittests.conf

View File

@ -337,7 +337,7 @@ class Blockdevice:
prefs["Programs"]["super"],
prefs["Programs"]["CryptoBoxRootActions"],
"program", "cryptsetup",
"--batch-mode", "isLuks", self.devnodes[0]])
"isLuks", self.devnodes[0]])
proc.wait()
result = proc.returncode == 0
## store result and return

View File

@ -738,16 +738,17 @@ class CryptoBoxContainer:
loc_data.child_pid = os.fork()
if loc_data.child_pid == 0:
## make the filesystem
mkfs_args = [ self.cbox.prefs["Programs"]["nice"],
self.cbox.prefs["Programs"]["mkfs"],
"-t", fs_type,
plain_device ]
loc_data.proc = subprocess.Popen(
shell = False,
stdin = None,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
args = [
self.cbox.prefs["Programs"]["nice"],
self.cbox.prefs["Programs"]["mkfs"],
"-t", fs_type,
plain_device ] )
args = mkfs_args)
self.cbox.log.debug("Will format LUKS device using `%s'" % mkfs_args)
loc_data.proc.wait()
## wait to allow error detection
if loc_data.proc.returncode == 0:

View File

@ -95,16 +95,12 @@ class CryptoBox:
"""
import logging
## basicConfig(...) needs python >= 2.4
################################################
## Set the default log level here:
DEFAULT_LOG_LEVEL=logging.ERROR
################################################
try:
log_handler = logging.getLogger("CryptoNAS")
logging.basicConfig(
format = '%(asctime)s CryptoNAS %(levelname)s: %(message)s',
stderr = sys.stderr)
log_handler.setLevel(DEFAULT_LOG_LEVEL)
log_handler.setLevel(logging.ERROR)
log_handler.info("loggingsystem is up'n running")
## from now on everything can be logged via self.log...
except: