From a4c9f27ed7010e215c921763ffe9232834ae8098 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Tue, 24 Dec 2019 11:06:01 +0530 Subject: [PATCH] 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 --- .../tripleo-ssh-known-hosts/tasks/main.yml | 22 ++++++++++--------- zuul.d/layout.yaml | 6 +++++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/tripleo_ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml b/tripleo_ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml index 9f403e3ae..4a8b412ae 100644 --- a/tripleo_ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml @@ -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 }} diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml index e9f11a19b..a9742e105 100644 --- a/zuul.d/layout.yaml +++ b/zuul.d/layout.yaml @@ -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