UX improvement when no nodes are found

When an operator executes a client command targetting the overcloud
the client performs a host lookup which can fail there are no hosts
returned from a given stack. This change implements a check that
the object has some value before attempting to iterate through the
nodes. If the object is null, an exception is raised to inform the
operator there was an error, and provides insight on how they might
resolve the issue. This is an improvement over the current setup
which simply results in an AttributeError should no nodes be
returned from a given stack.

Change-Id: Ib42a655a93a647651a20f1d6ac42fcb96bb4c271
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2021-03-04 15:10:59 -06:00
parent a99837dba8
commit 590df6635b
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
1 changed files with 5 additions and 0 deletions

View File

@ -105,6 +105,11 @@ def get_overcloud_hosts(stack, ssh_network):
ips = []
role_net_ip_map = utils.get_role_net_ip_map(stack)
blacklisted_ips = utils.get_blacklisted_ip_addresses(stack)
if not role_net_ip_map:
raise exceptions.DeploymentError(
'No overcloud hosts were found in the current stack.'
' Check the stack name and try again.'
)
for net_ip_map in role_net_ip_map.values():
# get a copy of the lists of ssh_network and ctlplane ips
# as blacklisted_ips will only be the ctlplane ips, we need