Handle null enabled_networks and role_networks

https://review.opendev.org/#/c/699502/ patch caused
issue in undercloud-minion job where role_networks is null,
this patch fixes it by handling null values, also this patch adds
undercloud-minion voting job to catch such failures in future.

Change-Id: Ibb07a0b003bffdd1c76ff5816dccdadecb684db4
This commit is contained in:
yatinkarel 2019-12-24 11:06:01 +05:30
parent 478daa5471
commit a4c9f27ed7
2 changed files with 18 additions and 10 deletions

View File

@ -53,17 +53,19 @@
{% if (cloud_domain is defined) and (ctlplane_ip is defined) %}
{% set line = '[' ~ ctlplane_ip ~ ']*,[' ~ host ~ '.' ~ cloud_domain ~ ']*,[' ~ host ~ ']*' %}
{% set role_networks = hostdata['role_networks'] | default([]) %}
{% if ((enabled_networks is defined) and ((enabled_networks | length) > 0) and ((role_networks | length) > 0)) %}
{% set line = line ~ ',' %}
{% for network in enabled_networks %}
{% if network in role_networks %}
{% set line = line ~ '[' ~ hostdata[(networks[network]["name"] ~ '_ip')] ~ ']*,[' ~ host ~ '.' ~ network.lower() ~ ']*,' %}
{% set line = line ~ '[' ~ host ~ '.' ~ network.lower() ~ '.' ~ cloud_domain ~ ']*' %}
{% if not loop.last %}
{% set line = line ~ ',' %}
{% if ((enabled_networks is defined and enabled_networks) and ((enabled_networks | length) > 0)) %}
{% if ((role_networks is defined and role_networks) and ((role_networks | length) > 0)) %}
{% set line = line ~ ',' %}
{% for network in enabled_networks %}
{% if network in role_networks %}
{% set line = line ~ '[' ~ hostdata[(networks[network]["name"] ~ '_ip')] ~ ']*,[' ~ host ~ '.' ~ network.lower() ~ ']*,' %}
{% set line = line ~ '[' ~ host ~ '.' ~ network.lower() ~ '.' ~ cloud_domain ~ ']*' %}
{% if not loop.last %}
{% set line = line ~ ',' %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% set line = line ~ ' ssh-rsa ' ~ hostdata['ansible_ssh_host_key_rsa_public'] | default(ansible_ssh_host_key_rsa_public) %}
{{ line }}

View File

@ -24,6 +24,11 @@
- ^tripleo_ansible/.*molecule.*
- ^tripleo_ansible/.*meta.*
- ^tripleo_ansible/roles/test_deps/.*
- tripleo-ci-centos-7-containers-undercloud-minion: &undercloud_minion
dependencies: *deps
files:
- ^tripleo_ansible/.*
irrelevant-files: *irrelevant_scenario_files
- tripleo-ci-centos-7-undercloud-containers: &undercloud_containers
dependencies: *deps
files:
@ -71,6 +76,7 @@
- openstack-tox-linters
- openstack-tox-docs: *tripleo-docs
- tripleo-ci-centos-7-containers-multinode: *containers_multinode
- tripleo-ci-centos-7-containers-undercloud-minion: *undercloud_minion
- tripleo-ci-centos-7-undercloud-containers: *undercloud_containers
- tripleo-ci-centos-7-scenario001-standalone: *scenario001
- tripleo-ci-centos-7-scenario002-standalone: *scenario002