summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hanreich <s.hanreich@proxmox.com>2025-03-10 09:50:59 +0100
committerThomas Lamprecht <t.lamprecht@proxmox.com>2025-04-07 17:43:41 +0200
commit5ff8aeb080ae99230fc6d2825722f49fd0fca3c0 (patch)
tree7d3e573e1fb154fa15b8d459b81822e83f528ac0
parentcea37c09da99adcaef1d7cf7dbbd8aa82796030d (diff)
ipam: netbox: no conditional assignments for descriptions
While it should make practically no difference, it opens up potential errors in the future, so just remove the conditional assignments and explicitly define the variable as undef, so the intention is more clear. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Link: https://lore.proxmox.com/20250310085103.30549-4-s.hanreich@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-rw-r--r--src/PVE/Network/SDN/Ipams/NetboxPlugin.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index 6595cbc..b51842c 100644
--- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
@@ -169,7 +169,8 @@ sub add_next_freeip {
die "could not find id for prefix $cidr";
}
- my $description = "mac:$mac" if $mac;
+ my $description = undef;
+ $description = "mac:$mac" if $mac;
eval {
my $result = netbox_api_request($plugin_config, "POST", "/ipam/prefixes/$internalid/available-ips/", {
@@ -197,7 +198,8 @@ sub add_range_next_freeip {
die "could not find id for ip range $range->{'start-address'}:$range->{'end-address'}";
}
- my $description = "mac:$data->{mac}" if $data->{mac};
+ my $description = undef;
+ $description = "mac:$data->{mac}" if $data->{mac};
eval {
my $result = netbox_api_request($plugin_config, "POST", "/ipam/ip-ranges/$internalid/available-ips/", {