From 6916f55c9a2e9eacc9874627009c5cddc3f42b1b Mon Sep 17 00:00:00 2001 From: John Fulton Date: Thu, 22 Sep 2022 15:48:51 -0400 Subject: [PATCH] get_overcloud_hosts() should not return a list with empty strings The get_overcloud_hosts() function was returning a list of IPs with empty strings, e.g. ['192.168.34.89', '', '192.168.34.32'], after a node was scaled down via `openstack overcloud node delete`. Remove empty strings from the list before returning them. Change-Id: I719e0bbb17c71f5472ad6e365a010f5a6243af2f Closes-Bug: #1990566 --- tripleoclient/tests/workflows/test_deployment.py | 3 ++- tripleoclient/workflows/deployment.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tripleoclient/tests/workflows/test_deployment.py b/tripleoclient/tests/workflows/test_deployment.py index f58951266..6a586d2e1 100644 --- a/tripleoclient/tests/workflows/test_deployment.py +++ b/tripleoclient/tests/workflows/test_deployment.py @@ -68,12 +68,13 @@ class TestDeploymentWorkflows(utils.TestCommand): mock_excluded_ip_addresses): stack = mock.Mock() working_dir = mock.Mock() + # empty string added to Compute ctlplane to test LP 1990566 fix mock_role_net_ip_map.return_value = { 'Controller': { 'ctlplane': ['1.1.1.1', '2.2.2.2', '3.3.3.3'], 'external': ['4.4.4.4', '5.5.5.5', '6.6.6.6']}, 'Compute': { - 'ctlplane': ['7.7.7.7', '8.8.8.8', '9.9.9.9'], + 'ctlplane': ['7.7.7.7', '', '8.8.8.8', '9.9.9.9'], 'external': ['10.10.10.10', '11.11.11.11', '12.12.12.12']}, } mock_excluded_ip_addresses.return_value = [] diff --git a/tripleoclient/workflows/deployment.py b/tripleoclient/workflows/deployment.py index a2ed23409..3874290bd 100644 --- a/tripleoclient/workflows/deployment.py +++ b/tripleoclient/workflows/deployment.py @@ -110,6 +110,8 @@ def get_overcloud_hosts(stack, ssh_network, working_dir): ips.extend(net_ips) + # ensure there are no empty strings in IP list (LP1990566) + ips = [i for i in ips if i] return ips