From: Stefan Hanreich Date: Mon, 10 Mar 2025 08:51:00 +0000 (+0100) Subject: ipam: netbox: add error handling to get_ips_from_mac X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b673a106c5b25a5d9e2586c51be764bfb01df506;p=mirror%2Fpve-network.git ipam: netbox: add error handling to get_ips_from_mac This function did not catch any possible errors, nor respect the $noerr parameter. Signed-off-by: Stefan Hanreich Tested-by: Hannes Duerr Link: https://lore.proxmox.com/20250310085103.30549-5-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm index b51842c..8051b3f 100644 --- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm +++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm @@ -247,6 +247,10 @@ sub get_ips_from_mac { my $data = eval { netbox_api_request($plugin_config, "GET", "/ipam/ip-addresses/?description__ic=$mac"); }; + if ($@) { + return if $noerr; + die "could not query ip address entry for mac $mac: $@"; + } for my $ip (@{$data->{results}}) { if ($ip->{family}->{value} == 4 && !$ip4) {