]> git.puffer.fish Git - matthieu/pve-network.git/commitdiff
ipam: netbox: add error handling to get_ips_from_mac
authorStefan Hanreich <s.hanreich@proxmox.com>
Mon, 10 Mar 2025 08:51:00 +0000 (09:51 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Apr 2025 15:43:45 +0000 (17:43 +0200)
This function did not catch any possible errors, nor respect the
$noerr parameter.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Link: https://lore.proxmox.com/20250310085103.30549-5-s.hanreich@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Network/SDN/Ipams/NetboxPlugin.pm

index b51842c596ec5068afb5ff18adab319fa4270102..8051b3f36832ced55d69e86956aa6352dcf4d2ed 100644 (file)
@@ -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) {