From eec8b05914878f52858f37bbf675994e4e80d74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9lestin=20Matte?= Date: Mon, 18 Sep 2023 21:20:46 +0200 Subject: [PATCH] kolla_address: check correct error return value Unlike other methods such as resolve(), get() does not return an Undefined object, but None. This removes 4 ansible-lint warnings in various files calling kolla_address. Closes-Bug: #2038281 Change-Id: I591a50512a954210f951c40a350ed4b9e1fc48ae --- kolla_ansible/kolla_address.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kolla_ansible/kolla_address.py b/kolla_ansible/kolla_address.py index 12dff1ad1e..4538e75a2c 100644 --- a/kolla_ansible/kolla_address.py +++ b/kolla_ansible/kolla_address.py @@ -48,7 +48,7 @@ def kolla_address(context, network_name, hostname=None): raise FilterError("'inventory_hostname' variable is unavailable") hostvars = context.get('hostvars') - if isinstance(hostvars, Undefined): + if hostvars is None or isinstance(hostvars, Undefined): raise FilterError("'hostvars' variable is unavailable") host = hostvars.get(hostname)