runner: Print out correctly jid, both in sync/async

This commit is contained in:
Mathieu Le Marec - Pasquet 2015-01-26 14:37:25 +01:00 committed by Thomas Jackson
parent f12c7b50b7
commit 47621192cd

View File

@ -123,7 +123,7 @@ class Runner(RunnerClient):
'''
Execute the runner sequence
'''
ret = {}
ret, async_pub = {}, {}
if self.opts.get('doc', False):
self.print_docs()
else:
@ -141,7 +141,8 @@ class Runner(RunnerClient):
# Run the runner!
if self.opts.get('async', False):
async_pub = self.async(self.opts['fun'], low, user=user)
log.info('Running in async mode. Results of this execution may '
# by default: info will be not enougth to be printed out !
log.warn('Running in async mode. Results of this execution may '
'be collected by attaching to the master event bus or '
'by examing the master job cache, if configured. '
'This execution is running under tag {tag}'.format(**async_pub))
@ -156,6 +157,12 @@ class Runner(RunnerClient):
async_pub['jid'],
False, # Don't daemonize
)
msg = 'Runner completed'
if async_pub.get('jid', ''):
msg += ': {async_pub[jid]}'
msg = msg .format(ret=ret, async_pub=async_pub)
# by default: info will be not enougth to be printed out !
log.warn(msg)
except salt.exceptions.SaltException as exc:
ret = str(exc)
if not self.opts.get('quiet', False):