]> git.puffer.fish Git - matthieu/pve-network.git/commitdiff
ipam: netbox: simplify helpers
authorStefan Hanreich <s.hanreich@proxmox.com>
Mon, 10 Mar 2025 08:50:58 +0000 (09:50 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Apr 2025 15:43:36 +0000 (17:43 +0200)
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>
src/PVE/Network/SDN/Ipams/NetboxPlugin.pm

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