[pve-devel] [PATCH pve-network 3/8] ipam: netbox: simplify helpers

Stefan Hanreich s.hanreich at proxmox.com
Fri Mar 7 18:43:47 CET 2025


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

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 src/PVE/Network/SDN/Ipams/NetboxPlugin.pm | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index ea0fd0c..99ff3d9 100644
--- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
@@ -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 {
-- 
2.39.5




More information about the pve-devel mailing list