Use lowercase hostname in inventory network config

The ansible inventory uses the neutron port dns_name as
hostname. The `dns_name` in neutron is always lowercase.
If a hostname with one or more capital letters are used in
baremetal deployment YAML the data lookup from `inventory-
network-config.yaml` does not succeed.

This change fixes this issue by converting the hostname to
lowercase when creating the content for `inventory-network-
config.yaml`

Closes-Bug: #1978356
Change-Id: I1ee53976ecc63d206d9604c896b1bb59807ad9ff
This commit is contained in:
Harald Jensås 2022-06-10 23:39:25 +02:00
parent fce91ae356
commit 0056c2b897
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed an issue where the generated ansible inventory would be incomplete
if any uppercase characters was used in overcloud node hostnames.
See bug: `1978356 <https://bugs.launchpad.net/tripleo/+bug/1978356>`_.

View File

@ -228,7 +228,7 @@ def generate_ansible_inventory_network_config(result, module_opts, instances,
hostname = instance['hostname']
role = hostname_role_map[hostname]
host = inventory[role]['hosts'].setdefault(hostname, dict())
host = inventory[role]['hosts'].setdefault(hostname.lower(), dict())
network_config = instance.get('network_config', dict())
set_network_config_defaults(module_opts, network_config)
translate_opts_for_tripleo_network_config_role(network_config)