mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix compat issues with /jobs return values.
* ensure that both the return and info keys are lists. * When the Result key doesn't match the expected shape, return an empty list of an empty dict (this matches existing behavior when looking for a non-existant JID).
This commit is contained in:
parent
4778bc7365
commit
78dd629f09
1 changed files with 6 additions and 3 deletions
|
@ -1329,10 +1329,13 @@ class Jobs(LowDataAdapter):
|
|||
|
||||
ret = {}
|
||||
if jid:
|
||||
ret['info'] = job_ret_info[0]
|
||||
ret['return'] = [dict((k, job_ret_info[0]['Result'][k]['return']) for k in job_ret_info[0]['Result'])]
|
||||
ret['info'] = [job_ret_info[0]]
|
||||
try:
|
||||
ret['return'] = [dict((k, job_ret_info[0]['Result'][k]['return']) for k in job_ret_info[0]['Result'])]
|
||||
except (TypeError, KeyError):
|
||||
ret['return'] = [{}]
|
||||
else:
|
||||
ret['return'] = job_ret_info[0]
|
||||
ret['return'] = [job_ret_info[0]]
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue