From 1f7b1a963a19590b5e0a47260236932026e3594d Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 29 Jun 2021 19:37:54 -0400 Subject: [PATCH] Check for no neutron network in inventory The host network or SSH network specified with --overcloud-ssh-network may not exist in Neutron. There is no requirement that it does. Add a check and log a warning instead of trying to use the None object when the network is not found. When it's not found, neutron data is not added to the inventory. Signed-off-by: James Slagle Change-Id: I20d6ae39511e368e724522d133a133d1c864cb1b --- tripleo_common/inventory.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tripleo_common/inventory.py b/tripleo_common/inventory.py index f40f8fd1c..c90ee7c78 100644 --- a/tripleo_common/inventory.py +++ b/tripleo_common/inventory.py @@ -500,10 +500,15 @@ class TripleoInventory(object): found_ctlplane_port = False ctlplane_net = self.connection.network.find_network( self.host_network) - for p in ports: - if p.network_id == ctlplane_net.id: - found_ctlplane_port = True - break + if ctlplane_net: + for p in ports: + if p.network_id == ctlplane_net.id: + found_ctlplane_port = True + break + else: + LOG.warning("Host SSH network %s not found in neutron, not " + "using neutron data for inventory", + self.host_network) if not found_ctlplane_port: return None