mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
parent
651e3926f7
commit
1d39eec69b
1 changed files with 20 additions and 19 deletions
|
@ -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):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue