Merge "Fix service_mapped_to_host filter"
This commit is contained in:
commit
8593909b91
kolla_ansible
@ -63,7 +63,7 @@ def service_mapped_to_host(context, service):
|
||||
|
||||
group = service.get("group")
|
||||
if group is not None:
|
||||
return group in context.get("groups")
|
||||
return group in context.get("group_names")
|
||||
|
||||
raise exception.FilterError(
|
||||
"Service definition for '%s' does not have a 'group' or "
|
||||
|
@ -104,14 +104,14 @@ class TestFilters(unittest.TestCase):
|
||||
service = {
|
||||
'group': 'foo'
|
||||
}
|
||||
context = self._make_context({'groups': ['foo', 'bar']})
|
||||
context = self._make_context({'group_names': ['foo', 'bar']})
|
||||
self.assertTrue(filters.service_mapped_to_host(context, service))
|
||||
|
||||
def test_service_mapped_to_host_not_in_group(self):
|
||||
service = {
|
||||
'group': 'foo'
|
||||
}
|
||||
context = self._make_context({'groups': ['bar']})
|
||||
context = self._make_context({'group_names': ['bar']})
|
||||
self.assertFalse(filters.service_mapped_to_host(context, service))
|
||||
|
||||
def test_service_mapped_to_host_no_attr(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user