diff --git a/kolla_ansible/filters.py b/kolla_ansible/filters.py index 0b238ecc87..bea423347e 100644 --- a/kolla_ansible/filters.py +++ b/kolla_ansible/filters.py @@ -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 " diff --git a/kolla_ansible/tests/unit/test_filters.py b/kolla_ansible/tests/unit/test_filters.py index c3314ae8cc..8eef4f0e09 100644 --- a/kolla_ansible/tests/unit/test_filters.py +++ b/kolla_ansible/tests/unit/test_filters.py @@ -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):