Skip events with minion lists but no jid

Some events just contain a timestamp and a minion list, but no jid.
These can safely be ignored, lest they cause supurious log messages.

Also, pass the syndic's id so that it can be stored in a unique file in
the job cache (in the local_cache returner).
This commit is contained in:
Erik Johnson 2016-03-05 00:44:46 -06:00
parent 651e3926f7
commit 1d39eec69b

View file

@ -1182,31 +1182,32 @@ class AESFuncs(object):
'''
Act on specific events from minions
'''
id_ = load['id']
if load.get('tag', '') == '_salt_error':
log.error('Received minion error from [{minion}]: '
'{data}'.format(minion=load['id'],
data=load['data']['message']))
log.error(
'Received minion error from [{minion}]: {data}'
.format(minion=id_, data=load['data']['message'])
)
for event in load.get('events', []):
event_data = event.get('data', {})
if 'minions' in event_data:
jid = event_data.get('jid')
if not jid:
# Should not happen but if it ever does we definitely want
# to know about it.
log.warning('No jid in event: %s', event_data)
else:
minions = event_data['minions']
try:
salt.utils.job.store_minions(
self.opts,
jid,
minions,
mminion=self.mminion)
except (KeyError, salt.exceptions.SaltCacheError) as exc:
log.error(
'Could not add minion(s) {0} for job {1}: {2}'
.format(minions, jid, exc)
)
continue
minions = event_data['minions']
try:
salt.utils.job.store_minions(
self.opts,
jid,
minions,
mminion=self.mminion,
syndic_id=id_)
except (KeyError, salt.exceptions.SaltCacheError) as exc:
log.error(
'Could not add minion(s) {0} for job {1}: {2}'
.format(minions, jid, exc)
)
def _return(self, load):
'''