diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index 2b5c5ca8d..e5c6f2c11 100644 --- a/tripleo_common/actions/parameters.py +++ b/tripleo_common/actions/parameters.py @@ -377,12 +377,12 @@ class GenerateFencingParametersAction(base.TripleOAction): # If the MAC isn't in the hostmap, this node hasn't been # provisioned, so no fencing parameters are necessary - if mac_addr not in hostmap: + if hostmap and mac_addr not in hostmap: continue # Build up fencing parameters based on which Ironic driver this # node is using - if node["pm_type"] == "pxe_ssh": + if hostmap and node["pm_type"] == "pxe_ssh": # Ironic fencing driver node_data["agent"] = "fence_ironic" params["auth_url"] = self.os_auth["auth_url"] @@ -401,7 +401,9 @@ class GenerateFencingParametersAction(base.TripleOAction): params["ipaddr"] = node["pm_addr"] params["passwd"] = node["pm_password"] params["login"] = node["pm_user"] - params["pcmk_host_list"] = hostmap[mac_addr]["compute_name"] + if hostmap: + params["pcmk_host_list"] = \ + hostmap[mac_addr]["compute_name"] if "pm_port" in node: params["ipport"] = node["pm_port"] if self.ipmi_lanplus: diff --git a/tripleo_common/utils/nodes.py b/tripleo_common/utils/nodes.py index 002e5597e..18607482d 100644 --- a/tripleo_common/utils/nodes.py +++ b/tripleo_common/utils/nodes.py @@ -664,7 +664,10 @@ def generate_hostmap(baremetal_client, compute_client): for port in baremetal_client.port.list(node=bm_node.uuid): hostmap[port.address] = {"compute_name": node.name, "baremetal_name": bm_node.name} - return hostmap + if hostmap == {}: + return None + else: + return hostmap def run_nova_cell_v2_discovery():