From 132b423863adec7730b881a6fc3e01b8fcc28f5c Mon Sep 17 00:00:00 2001 From: Steve Keay Date: Wed, 18 Dec 2024 13:03:24 +0000 Subject: [PATCH] Improve error messages and fix missing f in f-strings --- .../understack_workflows/bmc_network_config.py | 2 +- .../understack_workflows/nautobot_device.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/understack-workflows/understack_workflows/bmc_network_config.py b/python/understack-workflows/understack_workflows/bmc_network_config.py index d3a013d22..f645ce425 100644 --- a/python/understack-workflows/understack_workflows/bmc_network_config.py +++ b/python/understack-workflows/understack_workflows/bmc_network_config.py @@ -27,5 +27,5 @@ def bmc_set_permanent_ip_addr(bmc: Bmc, interface_info: InterfaceInfo): "IPv4.1.Netmask": str(interface_info.ipv4_address.netmask), } } - logger.info("BMC was DHCP, setting permanent {interface_info.ipv4_address}") + logger.info(f"BMC was DHCP IP {interface_info.ipv4_address}, making this permanent") bmc.redfish_request(REDFISH_PATH, method="PATCH", payload=payload) diff --git a/python/understack-workflows/understack_workflows/nautobot_device.py b/python/understack-workflows/understack_workflows/nautobot_device.py index aed543955..c1482a4d3 100644 --- a/python/understack-workflows/understack_workflows/nautobot_device.py +++ b/python/understack-workflows/understack_workflows/nautobot_device.py @@ -132,7 +132,11 @@ def switches_for(nautobot, chassis_info: ChassisInfo) -> dict[str, dict]: } switches = nautobot_switches(nautobot, switch_macs.union(base_switch_macs)) if not switches: - raise Exception("No switches found in nautobot for {switch_macs}") + raise Exception( + f"There are no switch Devices in nautobot that match the LLDP info " + f"reported by server BMC - I found no Devices where " + f"chassis_mac_address is one of {switch_macs}" + ) return switches