Updated to conform to proper ret values

This commit is contained in:
Brian Stevenson 2016-03-22 15:49:39 -07:00
parent d18b4be80b
commit b98f5517de

View File

@ -169,9 +169,9 @@ def list_absent(name, value):
- dev
'''
ret = {'name': name,
'changes': [],
'changes': {},
'result': True,
'comment': []}
'comment': ''}
grain = __grains__.get(name)
if grain:
if isinstance(grain, list):
@ -179,18 +179,18 @@ def list_absent(name, value):
value = [value]
for val in value:
if val not in grain:
ret['comment'].append('Value {1} is absent from ' \
'grain {0}'.format(name, val))
ret['comment'] += ('\nValue {1} is absent from '
'grain {0}'.format(name, val))
elif __opts__['test']:
ret['result'] = None
ret['comment'].append('Value {1} in grain {0} is set ' \
'to be deleted'.format(name, val))
ret['changes'].append({'deleted': val})
ret['comment'] += ('\nValue {1} in grain {0} is set '
'to be deleted'.format(name, val))
ret['changes'][val] = 'deleted'
elif val in grain:
__salt__['grains.remove'](name, val)
ret['comment'].append('Value {1} was deleted from ' \
'grain {0}'.format(name, val))
ret['changes'].append({'deleted': val})
ret['comment'] += ('\nValue {1} was deleted from '
'grain {0}'.format(name, val))
ret['changes'][val] = 'deleted'
return ret
else:
ret['result'] = False