Browse Source

Fixed integration issue with cryptsetup; unit tests now pass

master
frisco 13 years ago
parent
commit
9add2a7b34
  1. 1
      bin/cryptobox.conf
  2. 8
      src/cryptobox/core/blockdevice.py
  3. 11
      src/cryptobox/core/container.py
  4. 6
      src/cryptobox/core/main.py

1
bin/cryptobox.conf

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

8
src/cryptobox/core/blockdevice.py

@ -334,10 +334,10 @@ class Blockdevice:
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
args = [
prefs["Programs"]["super"],
prefs["Programs"]["CryptoBoxRootActions"],
"program", "cryptsetup",
"--batch-mode", "isLuks", self.devnodes[0]])
prefs["Programs"]["super"],
prefs["Programs"]["CryptoBoxRootActions"],
"program", "cryptsetup",
"isLuks", self.devnodes[0]])
proc.wait()
result = proc.returncode == 0
## store result and return

11
src/cryptobox/core/container.py

@ -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:

6
src/cryptobox/core/main.py

@ -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:

Loading…
Cancel
Save