mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add Caller functionality to reactors.
Not sure if this is 100% correct. Someone who understands the dynamic loading system should check this and correct as necessary. I cheat a bit by ignoring kwargs, but I didn't need it for what I needed to do.
This commit is contained in:
parent
6e18810745
commit
24cf6ebad5
1 changed files with 15 additions and 0 deletions
|
@ -233,3 +233,18 @@ class ReactWrap(object):
|
|||
log.warning('Attempt to in reactor by whell. Ignored.')
|
||||
except Exception as exc:
|
||||
log.warning('Exception caught by reactor: {0}'.format(exc))
|
||||
|
||||
def caller(self, fun, *args, **kwargs):
|
||||
'''
|
||||
Wrap Caller to enable executing :ref:`caller modules <all-salt.caller>`
|
||||
'''
|
||||
log.debug("in caller with fun {0} args {1} kwargs {2}".format(fun, args, kwargs))
|
||||
args = kwargs['args']
|
||||
if 'caller' not in self.client_cache:
|
||||
self.client_cache['caller'] = salt.client.Caller(self.opts['conf_file'])
|
||||
try:
|
||||
self.client_cache['caller'].function(fun, *args)
|
||||
except SystemExit:
|
||||
log.warning('Attempt to exit reactor. Ignored.')
|
||||
except Exception as exc:
|
||||
log.warning('Exception caught by reactor: {0}'.format(exc))
|
||||
|
|
Loading…
Add table
Reference in a new issue