ipam: netbox: simplify helpers

The helpers had lots of unnecessary intermediate assignments, which we
can just simplify.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Link: https://lore.proxmox.com/20250310085103.30549-3-s.hanreich@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Stefan Hanreich 2025-03-10 09:50:58 +01:00 committed by Thomas Lamprecht
parent 449e08a8fb
commit cea37c09da

View file

@ -288,8 +288,7 @@ sub get_prefix_id {
} }
my $data = @{$result->{results}}[0]; my $data = @{$result->{results}}[0];
my $internalid = $data->{id}; return $data->{id};
return $internalid;
} }
sub get_iprange_id { sub get_iprange_id {
@ -308,8 +307,7 @@ sub get_iprange_id {
} }
my $data = @{$result->{results}}[0]; my $data = @{$result->{results}}[0];
my $internalid = $data->{id}; return $data->{id};
return $internalid;
} }
sub get_ip_id { sub get_ip_id {
@ -322,8 +320,7 @@ sub get_ip_id {
} }
my $data = @{$result->{results}}[0]; my $data = @{$result->{results}}[0];
my $ip_id = $data->{id}; return $data->{id};
return $ip_id;
} }
sub is_ip_gateway { sub is_ip_gateway {
@ -336,9 +333,7 @@ sub is_ip_gateway {
} }
my $data = @{$result->{data}}[0]; my $data = @{$result->{data}}[0];
my $description = $data->{description}; return $data->{description} eq 'gateway';
my $is_gateway = 1 if $description eq 'gateway';
return $is_gateway;
} }
sub is_prefix_empty { sub is_prefix_empty {