mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Swapping out if state looking for test in opts for a __opts__.get
This commit is contained in:
parent
e1cf599eb3
commit
7f83b4baee
1 changed files with 7 additions and 7 deletions
|
@ -67,7 +67,7 @@ def present(name,
|
|||
if beacon_data == current_beacons[name]:
|
||||
ret['comment'].append('Job {0} in correct state'.format(name))
|
||||
else:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
kwargs['test'] = True
|
||||
result = __salt__['beacons.modify'](name, beacon_data)
|
||||
ret['comment'].append(result['comment'])
|
||||
|
@ -86,7 +86,7 @@ def present(name,
|
|||
ret['comment'].append(result['comment'])
|
||||
|
||||
else:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
kwargs['test'] = True
|
||||
result = __salt__['beacons.add'](name, beacon_data, **kwargs)
|
||||
ret['comment'].append(result['comment'])
|
||||
|
@ -100,7 +100,7 @@ def present(name,
|
|||
ret['comment'].append('Adding {0} to beacons'.format(name))
|
||||
|
||||
if save:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
ret['comment'].append('Beacon {0} would be saved'.format(name))
|
||||
else:
|
||||
result = __salt__['beacons.save']()
|
||||
|
@ -133,7 +133,7 @@ def absent(name,
|
|||
|
||||
current_beacons = __salt__['beacons.list'](return_yaml=False)
|
||||
if name in current_beacons:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
kwargs['test'] = True
|
||||
result = __salt__['beacons.delete'](name, **kwargs)
|
||||
ret['comment'].append(result['comment'])
|
||||
|
@ -149,7 +149,7 @@ def absent(name,
|
|||
ret['comment'].append('{0} not configured in beacons'.format(name))
|
||||
|
||||
if save:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
ret['comment'].append('Beacon {0} would be saved'.format(name))
|
||||
else:
|
||||
result = __salt__['beacons.save']()
|
||||
|
@ -178,7 +178,7 @@ def enabled(name, **kwargs):
|
|||
|
||||
current_beacons = __salt__['beacons.list'](return_yaml=False)
|
||||
if name in current_beacons:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
kwargs['test'] = True
|
||||
result = __salt__['beacons.enable_beacon'](name, **kwargs)
|
||||
ret['comment'].append(result['comment'])
|
||||
|
@ -216,7 +216,7 @@ def disabled(name, **kwargs):
|
|||
|
||||
current_beacons = __salt__['beacons.list'](return_yaml=False)
|
||||
if name in current_beacons:
|
||||
if 'test' in __opts__ and __opts__['test']:
|
||||
if __opts__.get('test'):
|
||||
kwargs['test'] = True
|
||||
result = __salt__['beacons.disable_beacon'](name, **kwargs)
|
||||
ret['comment'].append(result['comment'])
|
||||
|
|
Loading…
Add table
Reference in a new issue