[pve-devel] [PATCH pve-network 5/8] ipam: netbox: add error handling to get_ips_from_mac
Stefan Hanreich
s.hanreich at proxmox.com
Fri Mar 7 18:43:49 CET 2025
This function did not catch any possible errors, nor respect the
$noerr parameter.
Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
src/PVE/Network/SDN/Ipams/NetboxPlugin.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index 6e1f78b..0d9d5a3 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) {
--
2.39.5
More information about the pve-devel
mailing list