Merge "Fix service_mapped_to_host filter"

This commit is contained in:
Zuul 2020-03-20 20:22:18 +00:00 committed by Gerrit Code Review
commit 8593909b91
2 changed files with 3 additions and 3 deletions
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):