mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Handle when beacon not configured and we try to enable/disable them (#32692)
* Handle the situation when the beacon is not configured and we try to disable it * a couple more missing returns in the enable & disable
This commit is contained in:
parent
f52af5a596
commit
3aa0605033
@ -394,13 +394,16 @@ def enable_beacon(name, **kwargs):
|
||||
if not name:
|
||||
ret['comment'] = 'Beacon name is required.'
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
if 'test' in kwargs and kwargs['test']:
|
||||
ret['comment'] = 'Beacon {0} would be enabled.'.format(name)
|
||||
else:
|
||||
if name not in list_(return_yaml=True):
|
||||
_beacons = list_(return_yaml=False)
|
||||
if name not in _beacons:
|
||||
ret['comment'] = 'Beacon {0} is not currently configured.'.format(name)
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
try:
|
||||
eventer = salt.utils.event.get_event('minion', opts=__opts__)
|
||||
@ -442,13 +445,16 @@ def disable_beacon(name, **kwargs):
|
||||
if not name:
|
||||
ret['comment'] = 'Beacon name is required.'
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
if 'test' in kwargs and kwargs['test']:
|
||||
ret['comment'] = 'Beacons would be enabled.'
|
||||
else:
|
||||
if name not in list_(return_yaml=True):
|
||||
_beacons = list_(return_yaml=False)
|
||||
if name not in _beacons:
|
||||
ret['comment'] = 'Beacon {0} is not currently configured.'.format(name)
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
try:
|
||||
eventer = salt.utils.event.get_event('minion', opts=__opts__)
|
||||
|
Loading…
Reference in New Issue
Block a user