Fixing the beacons.reset function. Once the reset has taken place in beacons/__init__.py we need to fire an event back to complete the loop and ensure that everything worked as expected.

This commit is contained in:
Gareth J. Greenaway 2019-04-18 16:51:31 -07:00
parent ee3cbc7ca5
commit 353f9d4eb8
No known key found for this signature in database
GPG Key ID: 10B62F8A7CAD7A41
2 changed files with 13 additions and 2 deletions

View File

@ -434,3 +434,14 @@ class Beacon(object):
Reset the beacons to defaults
'''
self.opts['beacons'] = {}
comment = 'Beacon Reset'
complete = True
# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_reset_complete')
return True

View File

@ -614,7 +614,7 @@ def reset(**kwargs):
ret = {'comment': [],
'result': True}
if 'test' in kwargs and kwargs['test']:
if kwargs.get('test'):
ret['comment'] = 'Beacons would be reset.'
else:
try:
@ -629,7 +629,7 @@ def reset(**kwargs):
ret['comment'] = 'Beacon configuration reset.'
else:
ret['result'] = False
ret['comment'] = event_ret['comment']
ret['comment'] = 'Something went wrong.'
return ret
except KeyError:
# Effectively a no-op, since we can't really return without an event system