mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Rename function key_value_match to is
This commit is contained in:
parent
93306ba8a8
commit
ea7faa0935
@ -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))
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user