swapping out if...else approach for __opts__.get approach.

This commit is contained in:
Gareth J. Greenaway 2019-03-19 09:19:48 -07:00
parent aa2c626cdf
commit 6a5b5b28e2
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41
2 changed files with 2 additions and 8 deletions

View file

@ -25,10 +25,7 @@ def match(tgt):
'''
nodegroups = __opts__.get('nodegroups', {})
matchers = salt.loader.matchers(__opts__)
if 'minion_id' in __opts__:
minion_id = __opts__['minion_id']
else:
minion_id = __opts__['id']
minion_id = __opts__.get(['minion_id'], __opts__['id'])
if not isinstance(tgt, six.string_types) and not isinstance(tgt, (list, tuple)):
log.error('Compound target received that is neither string, list nor tuple')

View file

@ -12,10 +12,7 @@ def match(tgt):
'''
Returns true if the passed glob matches the id
'''
if 'minion_id' in __opts__:
minion_id = __opts__['minion_id']
else:
minion_id = __opts__['id']
minion_id = __opts__.get('minion_id', __opts__['id'])
if not isinstance(tgt, six.string_types):
return False