diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index 377ac4a35..6565f1e6c 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 76d4d056c..13a5c0f4d 100644 --- a/tripleo_common/utils/nodes.py +++ b/tripleo_common/utils/nodes.py @@ -634,7 +634,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():