# All rights reserved.
# expected /proc/partitions format
+from __future__ import print_function
+
import os, sys, shutil
import subprocess
import shlex
# in seconds : if no input, proceed
PROMPT_TIMEOUT = 5
-def prompt_for_breakpoint_mode ():
+def prompt_for_breakpoint_mode():
global BREAKPOINT_MODE
if PROMPT_MODE:
cmd = "/bin/sh"
message = message + " -- Entering bash - type ^D to proceed"
- print message
+ print(message)
os.system(cmd)
+ else:
+ print("Ignoring breakpoint (BREAKPOINT_MODE=False) : {}".format(message))
+
########################################
def makedirs(path):
if log is not None:
log.write("sysexec (shell mode) >>> {}".format(cmd))
if VERBOSE_MODE:
- print "sysexec (shell mode) >>> {}".format(cmd)
+ print("sysexec (shell mode) >>> {}".format(cmd))
else:
prog = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if log is not None:
log.write("sysexec >>> {}\n".format(cmd))
if VERBOSE_MODE:
- print "sysexec >>> {}".format(cmd)
+ print("sysexec >>> {}".format(cmd))
except OSError:
raise BootManagerException(
"Unable to create instance of subprocess.Popen "
same as sysexec, but capture boot manager exceptions
"""
try:
- rc= 0
- rc= sysexec(cmd, log, shell=shell)
+ rc = 0
+ rc = sysexec(cmd, log, shell=shell)
except BootManagerException as e:
pass
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))