Commit c8e16881 authored by Jérome Perrin's avatar Jérome Perrin

testing/utils: log crontab output when execution fail

parent 2fa78884
...@@ -218,10 +218,16 @@ class CrontabMixin(object): ...@@ -218,10 +218,16 @@ class CrontabMixin(object):
be a relative time. be a relative time.
""" """
crontab_command = self._getCrontabCommand(crontab_name) crontab_command = self._getCrontabCommand(crontab_name)
try:
crontab_output = subprocess.check_output( crontab_output = subprocess.check_output(
"faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()), "faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()),
shell=True, shell=True,
stderr=subprocess.STDOUT,
) )
except subprocess.CalledProcessError as e:
self.logger.debug('error executing crontab %s output: %s', crontab_command, e.output)
raise
else:
self.logger.debug("crontab %s output: %s", crontab_command, crontab_output) self.logger.debug("crontab %s output: %s", crontab_command, crontab_output)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment