mirror of
git://git.proxmox.com/git/pve-network.git
synced 2025-04-30 11:27:11 +02:00
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>
This commit is contained in:
parent
5ff8aeb080
commit
b673a106c5
|
@ -247,6 +247,10 @@ sub get_ips_from_mac {
|
||||||
my $data = eval {
|
my $data = eval {
|
||||||
netbox_api_request($plugin_config, "GET", "/ipam/ip-addresses/?description__ic=$mac");
|
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}}) {
|
for my $ip (@{$data->{results}}) {
|
||||||
if ($ip->{family}->{value} == 4 && !$ip4) {
|
if ($ip->{family}->{value} == 4 && !$ip4) {
|
||||||
|
|
Loading…
Reference in a new issue