summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hanreich <s.hanreich@proxmox.com>2025-03-10 09:51:00 +0100
committerThomas Lamprecht <t.lamprecht@proxmox.com>2025-04-07 17:43:45 +0200
commitb673a106c5b25a5d9e2586c51be764bfb01df506 (patch)
treea5049ac040533c6597c9a157baa6cfb09590544a
parent5ff8aeb080ae99230fc6d2825722f49fd0fca3c0 (diff)
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 <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>
-rw-r--r--src/PVE/Network/SDN/Ipams/NetboxPlugin.pm4
1 files changed, 4 insertions, 0 deletions
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) {