Switch from comprehension to logic used in jobs runner. This makes it

easier to deal with potential unicode in returns.
This commit is contained in:
Scott Thrasher 2016-09-02 10:14:45 -07:00 committed by rallytime
parent 78dd629f09
commit 0f897b2426

View File

@ -1330,10 +1330,14 @@ class Jobs(LowDataAdapter):
ret = {}
if jid:
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'] = [{}]
minion_ret = {}
returns = job_ret_info[0].get('Result')
for minion in returns.keys():
if u'return' in returns[minion]:
minion_ret[minion] = returns[minion].get(u'return')
else:
minion_ret[minion] = returns[minion].get('return')
ret['return'] = [minion_ret]
else:
ret['return'] = [job_ret_info[0]]