mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
fix nested grains always show update due to __grains__.get() not supporting the ":" seperator
This commit is contained in:
parent
fcfc6f4fd3
commit
3dae79d516
@ -134,7 +134,7 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
|
|||||||
'changes': {},
|
'changes': {},
|
||||||
'result': True,
|
'result': True,
|
||||||
'comment': ''}
|
'comment': ''}
|
||||||
grain = __grains__.get(name)
|
grain = __salt__['grains.get'](name)
|
||||||
|
|
||||||
if grain:
|
if grain:
|
||||||
# check whether grain is a list
|
# 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)
|
ret['comment'] = 'Grain {0} is not a valid list'.format(name)
|
||||||
return ret
|
return ret
|
||||||
if isinstance(value, list):
|
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)
|
ret['comment'] = 'Value {1} is already in grain {0}'.format(name, value)
|
||||||
return ret
|
return ret
|
||||||
else:
|
else:
|
||||||
@ -163,7 +163,7 @@ def list_present(name, value, delimiter=DEFAULT_TARGET_DELIM):
|
|||||||
return ret
|
return ret
|
||||||
new_grains = __salt__['grains.append'](name, value)
|
new_grains = __salt__['grains.append'](name, value)
|
||||||
if isinstance(value, list):
|
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['result'] = False
|
||||||
ret['comment'] = 'Failed append value {1} to grain {0}'.format(name, value)
|
ret['comment'] = 'Failed append value {1} to grain {0}'.format(name, value)
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user