mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add full_return support to RunnerClient.cmd_sync to expose exit code
This commit is contained in:
parent
e444e7da62
commit
065e24d101
@ -138,7 +138,7 @@ class SyncClientMixin(object):
|
||||
salt.utils.error.raise_error(**ret['error'])
|
||||
return ret
|
||||
|
||||
def cmd_sync(self, low, timeout=None):
|
||||
def cmd_sync(self, low, timeout=None, full_return=False):
|
||||
'''
|
||||
Execute a runner function synchronously; eauth is respected
|
||||
|
||||
@ -166,7 +166,7 @@ class SyncClientMixin(object):
|
||||
"RunnerClient job '{0}' timed out".format(job['jid']),
|
||||
jid=job['jid'])
|
||||
|
||||
return ret['data']['return']
|
||||
return ret if full_return else ret['data']['return']
|
||||
|
||||
def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
|
||||
'''
|
||||
|
@ -125,7 +125,7 @@ class NetapiClient(object):
|
||||
disable_custom_roster=True)
|
||||
return ssh_client.cmd_sync(kwargs)
|
||||
|
||||
def runner(self, fun, timeout=None, **kwargs):
|
||||
def runner(self, fun, timeout=None, full_return=False, **kwargs):
|
||||
'''
|
||||
Run `runner modules <all-salt.runners>` synchronously
|
||||
|
||||
@ -138,7 +138,7 @@ class NetapiClient(object):
|
||||
'''
|
||||
kwargs['fun'] = fun
|
||||
runner = salt.runner.RunnerClient(self.opts)
|
||||
return runner.cmd_sync(kwargs, timeout=timeout)
|
||||
return runner.cmd_sync(kwargs, timeout=timeout, full_return=full_return)
|
||||
|
||||
def runner_async(self, fun, **kwargs):
|
||||
'''
|
||||
|
@ -113,7 +113,7 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
|
||||
|
||||
return mixins.AsyncClientMixin.cmd_async(self, reformatted_low)
|
||||
|
||||
def cmd_sync(self, low, timeout=None):
|
||||
def cmd_sync(self, low, timeout=None, full_return=False):
|
||||
'''
|
||||
Execute a runner function synchronously; eauth is respected
|
||||
|
||||
@ -130,7 +130,7 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
|
||||
})
|
||||
'''
|
||||
reformatted_low = self._reformat_low(low)
|
||||
return mixins.SyncClientMixin.cmd_sync(self, reformatted_low, timeout)
|
||||
return mixins.SyncClientMixin.cmd_sync(self, reformatted_low, timeout, full_return)
|
||||
|
||||
def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user