Show simple error string, when subprocess batch actions fail
logs still have more info, can't show user the whole traceback..but this is better than we had before..
This commit is contained in:
parent
cea06c9673
commit
f80d3cd530
|
@ -963,12 +963,15 @@ class BatchMasterView(MasterView):
|
||||||
# run command in subprocess
|
# run command in subprocess
|
||||||
log.debug("launching command in subprocess: %s", cmd)
|
log.debug("launching command in subprocess: %s", cmd)
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(cmd, stderr=subprocess.PIPE)
|
# nb. we do not capture stderr, but on failure the stdout
|
||||||
|
# will contain a simple error string
|
||||||
|
subprocess.check_output(cmd)
|
||||||
except subprocess.CalledProcessError as error:
|
except subprocess.CalledProcessError as error:
|
||||||
log.warning("command failed with exit code %s! output was:",
|
log.warning("command failed with exit code %s! output was:",
|
||||||
error.returncode)
|
error.returncode)
|
||||||
log.warning(error.stderr.decode('utf_8'))
|
output = error.output.decode('utf_8')
|
||||||
raise
|
log.warning(output)
|
||||||
|
raise Exception(output)
|
||||||
|
|
||||||
def action_subprocess_thread(self, key, port, username, handler_action, progress, **kwargs):
|
def action_subprocess_thread(self, key, port, username, handler_action, progress, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -1009,8 +1012,8 @@ class BatchMasterView(MasterView):
|
||||||
progress.session.load()
|
progress.session.load()
|
||||||
progress.session['error'] = True
|
progress.session['error'] = True
|
||||||
progress.session['error_msg'] = (
|
progress.session['error_msg'] = (
|
||||||
"{} of '{}' batch failed (see logs for more info)").format(
|
"{} of '{}' batch failed: {} (see logs for more info)").format(
|
||||||
handler_action, self.handler.batch_key)
|
handler_action, self.handler.batch_key, error)
|
||||||
progress.session.save()
|
progress.session.save()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue