grains state: changes comment more accurate

This commit is contained in:
Christophe Drevet-Droguet 2015-09-04 08:38:20 +02:00 committed by rallytime
parent 563fd2b56c
commit 1c5cd4c82d
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ def present(name, value, delimiter=DEFAULT_TARGET_DELIM, force=False):
ret['changes'] = {'new': name}
else:
ret['comment'] = 'Grain {0} is set to be changed'.format(name)
ret['changes'] = {'new': name}
ret['changes'] = {'changed': {name: value}}
return ret
ret = __salt__['grains.set'](name, value, force=force)
if ret['result'] is True and ret['changes'] != {}:

View File

@ -325,7 +325,7 @@ class GrainsTestCase(TestCase):
name='foo',
value='newbar')
self.assertEqual(ret['result'], None)
self.assertEqual(ret['changes'], {'new': 'foo'})
self.assertEqual(ret['changes'], {'changed': {'foo': 'newbar'}})
self.assertEqual(
grains.__grains__,
{'a': 'aval', 'foo': 'bar'})