Merge "baremetal: fix /etc/hosts generation when api_interface has dashes"

This commit is contained in:
Zuul 2021-06-17 08:42:50 +00:00 committed by Gerrit Code Review
commit 4f8a716b1e
2 changed files with 9 additions and 2 deletions

View File

@ -28,7 +28,7 @@
marker: "# {mark} ANSIBLE GENERATED HOSTS"
block: |
{% for host in groups['baremetal'] %}
{% set api_interface = hostvars[host]['api_interface'] %}
{% set api_interface = hostvars[host]['api_interface'] | replace('-', '_') %}
{% if host not in groups['bifrost'] or 'ansible_' + api_interface in hostvars[host] %}
{% set hostnames = [hostvars[host]['ansible_nodename'], hostvars[host]['ansible_hostname']] %}
{{ 'api' | kolla_address(host) }} {{ hostnames | unique | join(' ') }}
@ -39,7 +39,7 @@
- customize_etc_hosts | bool
# Skip hosts in the bifrost group that do not have a valid api_interface.
- inventory_hostname not in groups['bifrost'] or
'ansible_' + hostvars[inventory_hostname]['api_interface'] in hostvars[inventory_hostname]
'ansible_' + hostvars[inventory_hostname]['api_interface'] | replace('-', '_') in hostvars[inventory_hostname]
# NOTE(osmanlicilegi): The distribution might come with cloud-init installed, and manage_etc_hosts
# configuration enabled. If so, it will override the file /etc/hosts from cloud-init templates at

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes an issue when generating ``/etc/hosts`` during ``kolla-ansible
bootstrap-servers`` when one or more hosts has an ``api_interface`` with
dashes (``-``) in its name. `LP#1927357
<https://bugs.launchpad.net/kolla-ansible/+bug/1927357>`__