Add missing **kwargs

This commit is contained in:
twangboy 2019-03-27 11:32:35 -06:00
parent 7e88d0478a
commit a5fa99a5c2
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB
3 changed files with 14 additions and 13 deletions

View file

@ -146,11 +146,11 @@ def add(name, beacon_data, **kwargs):
ret = {'comment': 'Failed to add beacon {0}.'.format(name),
'result': False}
if name in list_(return_yaml=False):
if name in list_(return_yaml=False, **kwargs):
ret['comment'] = 'Beacon {0} is already configured.'.format(name)
return ret
if name not in list_available(return_yaml=False):
if name not in list_available(return_yaml=False, **kwargs):
ret['comment'] = 'Beacon "{0}" is not available.'.format(name)
return ret
@ -223,7 +223,7 @@ def modify(name, beacon_data, **kwargs):
ret = {'comment': '',
'result': True}
current_beacons = list_(return_yaml=False)
current_beacons = list_(return_yaml=False, **kwargs)
if name not in current_beacons:
ret['comment'] = 'Beacon {0} is not configured.'.format(name)
return ret
@ -350,7 +350,7 @@ def delete(name, **kwargs):
return ret
def save():
def save(**kwargs):
'''
Save all beacons on the minion
@ -366,7 +366,7 @@ def save():
ret = {'comment': [],
'result': True}
beacons = list_(return_yaml=False, include_pillar=False)
beacons = list_(return_yaml=False, include_pillar=False, **kwargs)
# move this file into an configurable opt
sfn = os.path.join(__opts__['config_dir'],
@ -433,7 +433,7 @@ def enable(**kwargs):
def disable(**kwargs):
'''
Disable all beaconsd jobs on the minion
Disable all beacons jobs on the minion
:return: Boolean and status message on success or failure of disable.
@ -508,7 +508,7 @@ def enable_beacon(name, **kwargs):
if 'test' in kwargs and kwargs['test']:
ret['comment'] = 'Beacon {0} would be enabled.'.format(name)
else:
_beacons = list_(return_yaml=False)
_beacons = list_(return_yaml=False, **kwargs)
if name not in _beacons:
ret['comment'] = 'Beacon {0} is not currently configured.'.format(name)
ret['result'] = False
@ -566,7 +566,7 @@ def disable_beacon(name, **kwargs):
if 'test' in kwargs and kwargs['test']:
ret['comment'] = 'Beacons would be enabled.'
else:
_beacons = list_(return_yaml=False)
_beacons = list_(return_yaml=False, **kwargs)
if name not in _beacons:
ret['comment'] = 'Beacon {0} is not currently configured.'.format(name)
ret['result'] = False

View file

@ -46,7 +46,7 @@ class BeaconsAddDeleteTest(ModuleCase):
self.assertTrue(_add['result'])
# save added beacon
_save = self.run_function('beacons.save')
_save = self.run_function('beacons.save', f_timeout=300)
self.assertTrue(_save['result'])
# delete the beacon
@ -54,7 +54,7 @@ class BeaconsAddDeleteTest(ModuleCase):
self.assertTrue(_delete['result'])
# save the results
self.run_function('beacons.save')
self.run_function('beacons.save', f_timeout=300)
class BeaconsTest(ModuleCase):
@ -81,14 +81,14 @@ class BeaconsTest(ModuleCase):
self.run_function('beacons.add',
['ps', [{'processes': {'apache2': 'stopped'}}]],
f_timeout=300)
self.run_function('beacons.save')
self.run_function('beacons.save', f_timeout=300)
except CommandExecutionError:
self.skipTest('Unable to add beacon')
def tearDown(self):
# delete added beacon
self.run_function('beacons.delete', ['ps'], f_timeout=300)
self.run_function('beacons.save')
self.run_function('beacons.save', f_timeout=300)
# Reset beacons
self.run_function('beacons.reset', f_timeout=300)

View file

@ -33,7 +33,7 @@ class BeaconStateTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state(
'beacon.present',
name='diskusage',
timeout=300,
f_timeout=300,
**kwargs
)
self.assertSaltTrueReturn(ret)
@ -48,6 +48,7 @@ class BeaconStateTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state(
'beacon.absent',
name='diskusage',
f_timeout=300
)
self.assertSaltTrueReturn(ret)