From ff60f19a7fa66b18f04e7eee38a7208fd5ddb639 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Fri, 21 Jun 2024 16:50:32 +0200 Subject: [PATCH] Stop replacing dashes with underscores for Kolla interfaces This also removes test__run_one_with_dashes, because it's not needed anymore. Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/922478 Closes-Bug: #2070051 Change-Id: Ia11ac49986e2bebba17e533232d8cfd116ba9e73 (cherry picked from commit f2b042dcec55860bd7c57ca6c8db9e9a9580bab7) --- .../plugins/action/kolla_ansible_host_vars.py | 4 ---- .../action/test_kolla_ansible_host_vars.py | 20 ------------------- 2 files changed, 24 deletions(-) diff --git a/kayobe/plugins/action/kolla_ansible_host_vars.py b/kayobe/plugins/action/kolla_ansible_host_vars.py index 2a442b760..356c7e7ff 100644 --- a/kayobe/plugins/action/kolla_ansible_host_vars.py +++ b/kayobe/plugins/action/kolla_ansible_host_vars.py @@ -95,10 +95,6 @@ def _get_interface_fact(self, net_name, required, description): # Get the network interface for this network. iface = ("{{ '%s' | net_interface }}" % net_name) iface = self._templar.template(iface) - if iface: - # Ansible fact names replace dashes with underscores. - # FIXME(mgoddard): Is this still required? - iface = iface.replace('-', '_') if required and not iface: msg = ("Required network '%s' (%s) does not have an interface " "configured for this host" % (net_name, description)) diff --git a/kayobe/tests/unit/plugins/action/test_kolla_ansible_host_vars.py b/kayobe/tests/unit/plugins/action/test_kolla_ansible_host_vars.py index ec0a60d0f..667cd1329 100644 --- a/kayobe/tests/unit/plugins/action/test_kolla_ansible_host_vars.py +++ b/kayobe/tests/unit/plugins/action/test_kolla_ansible_host_vars.py @@ -136,26 +136,6 @@ def test__run_two_interfaces(self): } self.assertEqual(expected, result) - def test__run_one_with_dashes(self): - variables = copy.deepcopy(self.variables) - variables["foo_interface"] = "eth-0" - module = self._create_module(variables) - interfaces = [{ - "var_name": "kolla_foo_interface", - "network": "foo", - "description": "Foo network", - "required": False, - }] - result = module._run(interfaces, []) - expected = { - "changed": False, - "ansible_facts": { - "kolla_foo_interface": "eth_0", - }, - "_ansible_facts_cacheable": False, - } - self.assertEqual(expected, result) - def test__run_interface_not_mapped(self): module = self._create_module() interfaces = [{