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
This commit is contained in:
John Fulton 2022-09-22 15:48:51 -04:00
parent 3d0c60c27f
commit 6916f55c9a
2 changed files with 4 additions and 1 deletions

View File

@ -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 = []

View File

@ -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