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 <kieske@osism.tech>
Change-Id: Ied43b9d0c4b33bb514d367f3f99c2e30e104d139
This commit is contained in:
Sven Kieske 2024-08-13 09:42:27 +02:00
parent 416574c8b4
commit a5f0e16c03
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View File

@ -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/"

View File

@ -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 <https://bugs.launchpad.net/kolla/+bug/2076889>`__.