Skip to content
Snippets Groups Projects

Include original exception when logging an error in the infoblox client

Merged Karel van Klink requested to merge feature/improve-infoblox-logging into develop
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -203,9 +203,9 @@ def allocate_host(
network_view=network_view,
)
created_v6 = ipaddress.IPv6Address(new_host.ipv6addr)
except InfobloxCannotCreateObject:
except InfobloxCannotCreateObject as e:
msg = f"Cannot find 1 available IP address in network {ipv6_range}."
logger.warning(msg)
logger.warning(msg, exc_info=e)
if created_v6 is None:
msg = f"Cannot find 1 available IP address in networks {allocation_networks_v6}."
@@ -221,9 +221,9 @@ def allocate_host(
new_host.update()
new_host = objects.HostRecord.search(conn, name=hostname)
created_v4 = ipaddress.IPv4Address(new_host.ipv4addr)
except InfobloxCannotUpdateObject:
except InfobloxCannotUpdateObject as e:
msg = f"Cannot find 1 available IP address in network {ipv4_range}."
logger.warning(msg)
logger.warning(msg, exc_info=e)
if created_v4 is None:
msg = f"Cannot find 1 available IP address in networks {allocation_networks_v4}."
Loading