mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Use printer in place of event fire if sync
This commit is contained in:
parent
540f2edea5
commit
44741a9d8a
@ -153,7 +153,10 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
|
||||
# - the progress event system with the correct jid
|
||||
# - Provide JID if the runner wants to access it directly
|
||||
done = {}
|
||||
progress = salt.utils.event.get_runner_event(opts, data['jid']).fire_progress
|
||||
if opts.get('async', False):
|
||||
progress = salt.utils.event.get_runner_event(opts, data['jid']).fire_progress
|
||||
else:
|
||||
progress = _progress_print
|
||||
for func_name, func in instance.functions.items():
|
||||
if func.__module__ in done:
|
||||
continue
|
||||
@ -167,7 +170,9 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
|
||||
ret_load = {'return': ret, 'fun': data['fun'], 'fun_args': data['args']}
|
||||
# Don't use the invoking processes' event socket because it could be closed down by the time we arrive here.
|
||||
# Create another, for safety's sake.
|
||||
salt.utils.event.MasterEvent(opts['sock_dir']).fire_event(ret_load, tagify([data['jid'], 'return'], 'runner'))
|
||||
master_event = salt.utils.event.MasterEvent(opts['sock_dir'])
|
||||
master_event.fire_event(ret_load, tagify([data['jid'], 'return'], 'runner'))
|
||||
master_event.destroy()
|
||||
try:
|
||||
fstr = '{0}.save_runner_load'.format(opts['master_job_cache'])
|
||||
instance.returners[fstr](data['jid'], ret_load)
|
||||
@ -366,3 +371,7 @@ class Runner(RunnerClient):
|
||||
continue
|
||||
except (IndexError, KeyError):
|
||||
continue
|
||||
|
||||
|
||||
def _progress_print(text, *args, **kwargs):
|
||||
print(text)
|
||||
|
Loading…
Reference in New Issue
Block a user