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

View File

@ -24,6 +24,11 @@
- ^tripleo_ansible/.*molecule.* - ^tripleo_ansible/.*molecule.*
- ^tripleo_ansible/.*meta.* - ^tripleo_ansible/.*meta.*
- ^tripleo_ansible/roles/test_deps/.* - ^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 - tripleo-ci-centos-7-undercloud-containers: &undercloud_containers
dependencies: *deps dependencies: *deps
files: files:
@ -71,6 +76,7 @@
- openstack-tox-linters - openstack-tox-linters
- openstack-tox-docs: *tripleo-docs - openstack-tox-docs: *tripleo-docs
- tripleo-ci-centos-7-containers-multinode: *containers_multinode - 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-undercloud-containers: *undercloud_containers
- tripleo-ci-centos-7-scenario001-standalone: *scenario001 - tripleo-ci-centos-7-scenario001-standalone: *scenario001
- tripleo-ci-centos-7-scenario002-standalone: *scenario002 - tripleo-ci-centos-7-scenario002-standalone: *scenario002