Rename function key_value_match to is

This commit is contained in:
Jan Kadlec 2017-03-11 07:35:24 +01:00
parent 93306ba8a8
commit ea7faa0935
2 changed files with 7 additions and 7 deletions

View File

@ -767,7 +767,7 @@ def set(key,
return ret
def key_value_match(key, value):
def is(key, value):
'''
Used to make sure the minion's grain key/value matches.
@ -775,9 +775,9 @@ def key_value_match(key, value):
CLI Example:
salt '*' grains.key_value_match fqdn <expected_fqdn>
salt '*' grains.is fqdn <expected_fqdn>
salt '*' grains.key_value_match systemd:version 219
salt '*' grains.is systemd:version 219
'''
return str(value) == str(get(key))

View File

@ -605,7 +605,7 @@ class GrainsModuleTestCase(TestCase):
('z', 'zval'),
]))
def test_key_value_match(self):
def test_is(self):
grainsmod.__grains__ = OrderedDict([
('a', 'aval'),
('b', OrderedDict([
@ -615,10 +615,10 @@ class GrainsModuleTestCase(TestCase):
OrderedDict([('l23', 'l23val')])])
])),
('c', 8)])
res = grainsmod.key_value_match('a', 'aval')
res = grainsmod.is('a', 'aval')
self.assertEqual(type(res), bool)
self.assertTrue(res)
res = grainsmod.key_value_match('b:z', 'zval')
res = grainsmod.is('b:z', 'zval')
self.assertTrue(res)
res = grainsmod.key_value_match('b:z', 'aval')
res = grainsmod.is('b:z', 'aval')
self.assertFalse(res)