mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
some beacons are using the validate functions to ensure they're able to run, make sure they're handling the return data correctly. Tests for adb beacon rely on certain information being logged, adding those back in.
This commit is contained in:
parent
c588803bb6
commit
9bd784a1f1
@ -34,13 +34,17 @@ def validate(config):
|
||||
'''
|
||||
# Configuration for adb beacon should be a dictionary with states array
|
||||
if not isinstance(config, dict):
|
||||
log.info('Configuration for adb beacon must be a dict.')
|
||||
return False, ('Configuration for adb beacon must be a dict.')
|
||||
elif 'states' not in config.keys():
|
||||
log.info('Configuration for adb beacon must include a states array.')
|
||||
return False, ('Configuration for adb beacon must include a states array.')
|
||||
else:
|
||||
states = ['offline', 'bootloader', 'device', 'host', 'recovery', 'no permissions',
|
||||
'sideload', 'unauthorized', 'unknown', 'missing']
|
||||
if any(s not in states for s in config['states']):
|
||||
log.info('Need a one of the following adb '
|
||||
'states: {0}'.format(', '.join(states)))
|
||||
return False, ('Need a one of the following adb '
|
||||
'states: {0}'.format(', '.join(states)))
|
||||
return True, 'Valid beacon configuration'
|
||||
@ -70,7 +74,8 @@ def beacon(config):
|
||||
log.trace('adb beacon starting')
|
||||
ret = []
|
||||
|
||||
if not validate(config):
|
||||
_validate = validate(config)
|
||||
if not _validate[0]:
|
||||
return ret
|
||||
|
||||
out = __salt__['cmd.run']('adb devices', runas=config.get('user', None))
|
||||
|
@ -59,7 +59,8 @@ def beacon(config):
|
||||
log.trace('glxinfo beacon starting')
|
||||
ret = []
|
||||
|
||||
if not validate(config):
|
||||
_validate = validate(config)
|
||||
if not _validate[0]:
|
||||
return ret
|
||||
|
||||
retcode = __salt__['cmd.retcode']('DISPLAY=:0 glxinfo', runas=config['user'], python_shell=True)
|
||||
|
@ -48,7 +48,8 @@ def beacon(config):
|
||||
- refresh: True
|
||||
'''
|
||||
ret = []
|
||||
if not validate(config):
|
||||
_validate = validate(config)
|
||||
if not _validate[0]:
|
||||
return ret
|
||||
|
||||
_refresh = False
|
||||
|
Loading…
Reference in New Issue
Block a user