Construction/execution d'un conteneur à partir de l'image de base spécifiée dans le profil

This commit is contained in:
2017-01-20 17:22:54 +01:00
parent b88493523f
commit 487c97e88c
3 changed files with 51 additions and 11 deletions

View File

@ -59,15 +59,21 @@ def download_acbuild():
web.download_file(file_url=url, dest_path=file_path)
return file_path
def run_rkt(args):
def run_rkt(args, asRoot = False, captureOutput=False):
"""Run rkt with the specified args (use the local copy if rkt is not found in the $PATH)"""
rkt_bin = system.which('rkt', get_workspace_subdir('rkt'))
cmd = ( ["sudo", "-E", rkt_bin] if os.geteuid() != 0 else [rkt_bin] ) + args
cmd = ( ["sudo", "-E", rkt_bin] if os.geteuid() != 0 and asRoot == True else [rkt_bin] ) + args
print(" ".join(cmd))
return subprocess.call(cmd, stdin=subprocess.PIPE)
if captureOutput:
return subprocess.check_output(cmd, stdin=subprocess.PIPE)
else:
return subprocess.call(cmd, stdin=subprocess.PIPE)
def run_acbuild(args):
def run_acbuild(args, captureOutput=False):
"""Run acbuild with the specified args (use the local copy if acbuild is not found in the $PATH)"""
acbuild_bin = system.which('acbuild', get_workspace_subdir('acbuild'))
print(" ".join([acbuild_bin] + args))
return subprocess.call([acbuild_bin] + args, stdin=subprocess.PIPE)
if captureOutput:
return subprocess.check_output([acbuild_bin] + args, stdin=subprocess.PIPE)
else:
return subprocess.call([acbuild_bin] + args, stdin=subprocess.PIPE)