From 590df6635b7bd1f38e99a038b7db54c41976bd0e Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 4 Mar 2021 15:10:59 -0600 Subject: [PATCH] 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 --- tripleoclient/workflows/deployment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tripleoclient/workflows/deployment.py b/tripleoclient/workflows/deployment.py index 442219cbb..a46c38d45 100644 --- a/tripleoclient/workflows/deployment.py +++ b/tripleoclient/workflows/deployment.py @@ -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