fix nested grains always show update due to __grains__.get() not supporting the ":" seperator

This commit is contained in:
Jorge Schrauwen 2016-01-27 23:31:09 +00:00 committed by rallytime
parent fcfc6f4fd3
commit 3dae79d516

View File

@ -134,7 +134,7 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
'changes': {},
'result': True,
'comment': ''}
grain = __grains__.get(name)
grain = __salt__['grains.get'](name)
if grain:
# check whether grain is a list
@ -143,7 +143,7 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
ret['comment'] = 'Grain {0} is not a valid list'.format(name)
return ret
if isinstance(value, list):
if set(value).issubset(set(__grains__.get(name))):
if set(value).issubset(set(__salt__['grains.get'](name))):
ret['comment'] = 'Value {1} is already in grain {0}'.format(name, value)
return ret
else:
@ -163,7 +163,7 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
return ret
new_grains = __salt__['grains.append'](name, value)
if isinstance(value, list):
if not set(value).issubset(set(__grains__.get(name))):
if not set(value).issubset(set(__salt__['grains.get'](name))):
ret['result'] = False
ret['comment'] = 'Failed append value {1} to grain {0}'.format(name, value)
return ret