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:
parent
a99837dba8
commit
590df6635b
|
@ -105,6 +105,11 @@ def get_overcloud_hosts(stack, ssh_network):
|
||||||
ips = []
|
ips = []
|
||||||
role_net_ip_map = utils.get_role_net_ip_map(stack)
|
role_net_ip_map = utils.get_role_net_ip_map(stack)
|
||||||
blacklisted_ips = utils.get_blacklisted_ip_addresses(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():
|
for net_ip_map in role_net_ip_map.values():
|
||||||
# get a copy of the lists of ssh_network and ctlplane ips
|
# get a copy of the lists of ssh_network and ctlplane ips
|
||||||
# as blacklisted_ips will only be the ctlplane ips, we need
|
# as blacklisted_ips will only be the ctlplane ips, we need
|
||||||
|
|
Loading…
Reference in New Issue