X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Futils.py;h=76d2d476d85f17dbe2cdd2a14d25e7f3202c8e23;hb=46b41536888fa22002b7919dc5959b0e0dc2fdb2;hp=652d8099bcbaf26f990b63328014abfdd5766e57;hpb=099b149838e51d6b04bb73073738bf1e4a5e67ad;p=bootmanager.git diff --git a/source/utils.py b/source/utils.py index 652d809..76d2d47 100644 --- a/source/utils.py +++ b/source/utils.py @@ -80,6 +80,9 @@ def breakpoint (message, cmd = None): print(message) os.system(cmd) + else: + print("Ignoring breakpoint (BREAKPOINT_MODE=False) : {}".format(message)) + ######################################## def makedirs(path): @@ -210,7 +213,7 @@ def sysexec_chroot_noerr(path, cmd, log=None, shell=False): """ try: rc = 0 - rc = sysexec_chroot(cmd, log, shell=shell) + rc = sysexec_chroot(path, cmd, log, shell=shell) except BootManagerException as e: pass @@ -310,3 +313,12 @@ def sha1_file(filename): return m.hexdigest() except IOError: raise BootManagerException("Cannot calculate SHA1 hash of {}".format(filename)) + +def display_disks_status(PARTITIONS, message, log): + log.write("{} - PARTITIONS status - BEG\n".format(message)) + sysexec_noerr("vgdisplay", log) + sysexec_noerr("pvdisplay", log) + for name, path in PARTITIONS.items(): + log.write("PARTITIONS[{}]={}\n".format(name,path)) + sysexec_noerr("ls -l {}".format(path), log) + log.write("{} - PARTITIONS status - END\n".format(message))