Support conditional 'shell=True' calls, required for top's redirection, and not supported in curtin...

This commit is contained in:
Mathieu Trudel-Lapierre 2016-12-22 22:15:02 -05:00
parent 0f39f471b1
commit 87b8dc3ccc
2 changed files with 14 additions and 6 deletions

View File

@ -112,17 +112,21 @@ class InstallProgressController(BaseController):
raise Exception('AIEEE!')
self.install_spawned = True
shell = False
if self.opts.dry_run:
log.debug("Installprogress: this is a dry-run")
curtin_cmd = ["top", "-d", "0.5", "-n", "20", "-b", "-p",
str(os.getpid()), ">", self.install_log]
str(os.getpid()),
'>', self.install_log,
'2>', self.install_log]
shell = True
else:
log.debug("Installprogress: this is the *REAL* thing")
configs = [CURTIN_CONFIGS['storage']]
curtin_cmd = curtin_install_cmd(configs)
log.debug('Curtin install cmd: {}'.format(curtin_cmd))
result = yield utils.run_command_async(curtin_cmd)
result = yield utils.run_command_async(curtin_cmd, shell=shell)
log.debug('curtin_install: result: {}'.format(result))
if result['status'] > 0:
msg = ("Problem with curtin "
@ -151,12 +155,16 @@ class InstallProgressController(BaseController):
log.error('Attempting to spawn curtin install without a config')
raise Exception('AIEEE!')
shell = False
self.postinstall_spawned = True
self.install_log = CURTIN_POSTINSTALL_LOG
if self.opts.dry_run:
log.debug("Installprogress: this is a dry-run")
curtin_cmd = ["top", "-d", "0.5", "-n", "20", "-b", "-p",
str(os.getpid()), ">", self.install_log]
str(os.getpid()),
'>', self.install_log,
'2>', self.install_log]
shell = True
else:
log.debug("Installprogress: this is the *REAL* thing")
configs = [
@ -166,7 +174,7 @@ class InstallProgressController(BaseController):
curtin_cmd = curtin_install_cmd(configs)
log.debug('Curtin postinstall cmd: {}'.format(curtin_cmd))
result = yield utils.run_command_async(curtin_cmd)
result = yield utils.run_command_async(curtin_cmd, shell=shell)
if result['status'] > 0:
msg = ("Problem with curtin "
"post-install: {}".format(result))

View File

@ -86,9 +86,9 @@ def environment_check(check):
return env_ok
def run_command_async(cmd, timeout=None):
def run_command_async(cmd, timeout=None, shell=False):
log.debug('calling Async command: {}'.format(cmd))
return Async.pool.submit(run_command, cmd, timeout)
return Async.pool.submit(run_command, cmd, timeout, shell)
def run_command_start(command, timeout=None, shell=False):