mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Shuffling things around and adding the ability to return an event on the event bus when a runner function is unavailale
This commit is contained in:
parent
6f392c5301
commit
aa3e33bb32
@ -175,6 +175,10 @@ class Runner(RunnerClient):
|
||||
else:
|
||||
low = {'fun': self.opts['fun']}
|
||||
try:
|
||||
# Allocate a jid
|
||||
async_pub = self._gen_async_pub()
|
||||
self.jid = async_pub['jid']
|
||||
|
||||
verify_fun(self.functions, low['fun'])
|
||||
args, kwargs = salt.minion.load_args_and_kwargs(
|
||||
self.functions[low['fun']],
|
||||
@ -216,10 +220,6 @@ class Runner(RunnerClient):
|
||||
else:
|
||||
user = salt.utils.get_specific_user()
|
||||
|
||||
# Allocate a jid
|
||||
async_pub = self._gen_async_pub()
|
||||
self.jid = async_pub['jid']
|
||||
|
||||
if low['fun'] == 'state.orchestrate':
|
||||
low['kwarg']['orchestration_jid'] = async_pub['jid']
|
||||
|
||||
@ -256,6 +256,13 @@ class Runner(RunnerClient):
|
||||
async_pub['jid'],
|
||||
daemonize=False)
|
||||
except salt.exceptions.SaltException as exc:
|
||||
evt = salt.utils.event.get_event('master', opts=self.opts)
|
||||
evt.fire_event({'success': False,
|
||||
'comment': 'Runner function {0} is not '
|
||||
'available'.format(low['fun']),
|
||||
'fun': low['fun'],
|
||||
'jid': self.jid},
|
||||
tag='salt/run/{0}/ret'.format(self.jid))
|
||||
ret = '{0}'.format(exc)
|
||||
if not self.opts.get('quiet', False):
|
||||
display_output(ret, 'nested', self.opts)
|
||||
|
Loading…
Reference in New Issue
Block a user