From a5f0e16c03c2f45c16621de0142976e76a23c7f1 Mon Sep 17 00:00:00 2001 From: Sven Kieske Date: Tue, 13 Aug 2024 09:42:27 +0200 Subject: [PATCH] external/internal vip: use proper ip comparison The variable kolla_same_external_internal_vip in group_vars/all.yml was set to true or false depending on the jinja2 equality operator - == - which only checks if two objects are the same. This is problematic because IPs can be the same but have different string representations, e.g. leading zeroes in some octets, but still repesent the same instance of an IP. Example: 192.168.1.1 and 192.168.001.001 are the same. Fix this, by using the ansible.utils.ipaddr() jinja2 filter instead to increase robustness. Closes-Bug: #2076889 Introduced-By: https://review.opendev.org/c/openstack/kolla/+/285005 Signed-off-by: Sven Kieske Change-Id: Ied43b9d0c4b33bb514d367f3f99c2e30e104d139 --- ansible/group_vars/all.yml | 2 +- .../notes/use_proper_ip_comparison-1ed77a21eb560079.yaml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/use_proper_ip_comparison-1ed77a21eb560079.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 57d195a68a..fd1398bb2e 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -56,7 +56,7 @@ kolla_base_distro: "rocky" kolla_internal_vip_address: "{{ kolla_internal_address | default('') }}" kolla_internal_fqdn: "{{ kolla_internal_vip_address }}" kolla_external_vip_address: "{{ kolla_internal_vip_address }}" -kolla_same_external_internal_vip: "{{ kolla_external_vip_address == kolla_internal_vip_address }}" +kolla_same_external_internal_vip: "{{ kolla_external_vip_address | ansible.utils.ipaddr('address') == kolla_internal_vip_address | ansible.utils.ipaddr('address') }}" kolla_external_fqdn: "{{ kolla_internal_fqdn if kolla_same_external_internal_vip | bool else kolla_external_vip_address }}" kolla_dev_repos_directory: "/opt/stack/" diff --git a/releasenotes/notes/use_proper_ip_comparison-1ed77a21eb560079.yaml b/releasenotes/notes/use_proper_ip_comparison-1ed77a21eb560079.yaml new file mode 100644 index 0000000000..66e8581c5d --- /dev/null +++ b/releasenotes/notes/use_proper_ip_comparison-1ed77a21eb560079.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes a bug where the IP address comparison was not done properly + for the variable ``kolla_same_external_internal_vip``. + Fix the comparison to use the ``ipaddr`` filter instead. + For details see `LP#2076889 `__.