ret interface — VMware Salt API
ret interface
The LoadedMod class allows for the module loaded onto the sub to return custom sequencing, for instance it can be iterated over to return all functions
Return a dictionary of the last function called for all minions. Including fun will restrict the result set to minions for which fun was their last function called.
Parameters
| fun: | Limit result set to minions that called this function last. |
|---|
Get the results for a specific job by its job id (jid).
More information on jobs can be found in the VMware Salt documentation on Broadcom's TechDocs.
Parameters
| jid: | Job ID. |
|---|
Get all Job IDs for a given range. Warning, with no boundaries this call can return a huge amount of data.
More information on jobs can be found in the VMware Salt documentation on Broadcom's TechDocs.
Parameters
| start: | Timestamp from which to start. |
|---|---|
| end: | Timestamp at which to end. |
| limit: | Maximum number of job entries to return. |
Return the load for the given JID from the given master.
Parameters
| master_id: | ID for the master (not UUID) |
|---|---|
| jid: | Job ID. |
Returns a dictionary of the current list of known minion IDs keyed by master ID
get_returns() by JID example:
client.api.ret.get_returns(jid='20171205214029544461')
get_returns() by function example:
client.api.ret.get_returns(minion_id='minion1')
get_returns () by minion ID example:
client.api.ret.get_returns(minion_id='minion2')
Example:
client.api.ret.get_minions() RPCResponse(riq=28, ret= {u'saltmaster1_master': [u's01-m01', u's01-m02', u's01-m03', ....], u'saltmaster2_master': [u's02-m01', u's02-m02', u's02-m03', ....], u'saltmaster3_master': [u's03-m01', u's03-m02', u's03-m03', ....]}, error=None, warnings=[])
Return job results from the job cache based on the provided arguments.
Parameters
| jid: | Job ID. |
|---|---|
| master_id: | Return results only for jobs run on this master. |
| minion_id: | Return results only for jobs executed on this minion. |
| fun: | Return results for this called function. |
| user: | Restrict results to jobs executed by this user. |
| job_name: | Filter by job_name |
| job_uuid: | Return results for this job's UUID (not Job ID (jid)) |
| tgt_name: | Filter by tgt_name |
| tgt_uuid: | Return job results executed via this target group. |
| match_tgt_uuid: | Return job results for jobs matching this target group. |
| args: | filter by an argument string |
| highstate: | Return only results that were generated via highstate. |
| start: | Return results starting from this timestamp. |
| end: | Stop returning results at this timestamp. |
| limit: | Limit results to this number of jobs. |
| has_errors: | Return results for those jobs with errors. |
| sort_by: | Return results sorted by minion_id, function, has_errors, or jid. |
| reverse: | Return results sorted in the reverse order. |
| page: | Return job results from this page. Page starts from 0. |
get_returns() example:
client.api.ret.get_returns()
The return payload is a dictionary with the following elements:
{ 'count': 100, # total job returns count 'limit': 50, # results count 'results': [...] # job returns }
Example:
client.api.ret.get_returns(jid='20150430164924016227') RPCResponse( { 'count': 1, 'limit': 1, 'results': [ { 'alter_time': '2018-06-29T21:29:37.720943', 'full_ret': { '_stamp': '2015-04-30T16:49:24.379894', 'cmd': '_return', 'fun': 'pillar.items', 'fun_args': [], 'id': 'raas_test_ret_returns_minion', 'jid': '20150430164924016227', 'master_id': 'raas_test_ret_returns_master', 'retcode': 0, 'return': { 'baz': 'qux', 'lxc-cluster': True, 'qux': 'baz'}, 'success': True}, 'fun': 'pillar.items', 'fun_args': [], 'has_errors': False, 'jid': '20150430164924016227', 'master': 'raas_test_ret_returns_master', 'master_uuid': '5c56659b-0619-45bc-8ad7-e805c28d85ce', 'minion_id': 'raas_test_ret_returns_minion', 'return': {'baz': 'qux', 'lxc-cluster': True, 'qux': 'baz'}}]})