* [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496
@ 2024-11-28 17:43 Lou Lecrivain via pve-devel
2024-12-05 15:47 ` Stefan Hanreich
0 siblings, 1 reply; 3+ messages in thread
From: Lou Lecrivain via pve-devel @ 2024-11-28 17:43 UTC (permalink / raw)
To: pve-devel; +Cc: Lou Lecrivain, jacobgreen
[-- Attachment #1: Type: message/rfc822, Size: 5742 bytes --]
From: Lou Lecrivain <lou.lecrivain@wdz.de>
To: pve-devel@lists.proxmox.com
Cc: Lou Lecrivain <lou.lecrivain@wdz.de>, jacobgreen@corporatetools.com
Subject: SPAM: [PATCH pve-network] ipam: fix #5496
Date: Thu, 28 Nov 2024 18:43:43 +0100
Message-ID: <20241128174343.8691-1-lou.lecrivain@wdz.de>
functions were returning undef despite API calls being successfull,
due to eval blocks return values not being taken into account.
Co-authored-by: jacobgreen@corporatetools.com
Signed-off-by: lou lecrivain <lou.lecrivain@wdz.de>
---
src/PVE/Network/SDN/Ipams/NetboxPlugin.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index d923269..124c355 100644
--- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
@@ -151,7 +151,7 @@ sub add_next_freeip {
my $params = { dns_name => $hostname, description => $description };
- eval {
+ my $ip = eval {
my $result = PVE::Network::SDN::api_request("POST", "$url/ipam/prefixes/$internalid/available-ips/", $headers, $params);
my ($ip, undef) = split(/\//, $result->{address});
return $ip;
@@ -160,6 +160,8 @@ sub add_next_freeip {
if ($@) {
die "can't find free ip in subnet $cidr: $@" if !$noerr;
}
+
+ return $ip;
}
sub add_range_next_freeip {
@@ -174,7 +176,7 @@ sub add_range_next_freeip {
my $params = { dns_name => $data->{hostname}, description => $description };
- eval {
+ my $ip = eval {
my $result = PVE::Network::SDN::api_request("POST", "$url/ipam/ip-ranges/$internalid/available-ips/", $headers, $params);
my ($ip, undef) = split(/\//, $result->{address});
print "found ip free $ip in range $range->{'start-address'}-$range->{'end-address'}\n" if $ip;
@@ -184,6 +186,8 @@ sub add_range_next_freeip {
if ($@) {
die "can't find free ip in range $range->{'start-address'}-$range->{'end-address'}: $@" if !$noerr;
}
+
+ return $ip;
}
sub del_ip {
--
2.39.5
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496
2024-11-28 17:43 [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496 Lou Lecrivain via pve-devel
@ 2024-12-05 15:47 ` Stefan Hanreich
2024-12-05 15:51 ` Lou Lecrivain via pve-devel
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hanreich @ 2024-12-05 15:47 UTC (permalink / raw)
To: Proxmox VE development discussion; +Cc: jacobgreen
Thanks for sending the patch, ran this against my local instance and it
worked!
Consider this *commit*
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496
2024-12-05 15:47 ` Stefan Hanreich
@ 2024-12-05 15:51 ` Lou Lecrivain via pve-devel
0 siblings, 0 replies; 3+ messages in thread
From: Lou Lecrivain via pve-devel @ 2024-12-05 15:51 UTC (permalink / raw)
To: s.hanreich, pve-devel; +Cc: Lou.Lecrivain, jacobgreen
[-- Attachment #1: Type: message/rfc822, Size: 12374 bytes --]
From: <Lou.Lecrivain@wdz.de>
To: <s.hanreich@proxmox.com>, <pve-devel@lists.proxmox.com>
Cc: <jacobgreen@corporatetools.com>
Subject: Re: [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496
Date: Thu, 5 Dec 2024 15:51:51 +0000
Message-ID: <BE1P281MB211640AA780027373906B74885302@BE1P281MB2116.DEUP281.PROD.OUTLOOK.COM>
Hey Stefan,
Thanks for your input. I'll add this in the commit and submit a v2.
BR
________________________________________
De : Stefan Hanreich <s.hanreich@proxmox.com>
Envoyé : jeudi 5 décembre 2024 16:47
À : Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc : Lecrivain, Lou (WDZ) <Lou.Lecrivain@wdz.de>; jacobgreen@corporatetools.com <jacobgreen@corporatetools.com>
Objet : [!!ACHTUNG extern!!] - Re: [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496
Thanks for sending the patch, ran this against my local instance and it
worked!
Consider this *commit*
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-05 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-28 17:43 [pve-devel] SPAM: [PATCH pve-network] ipam: fix #5496 Lou Lecrivain via pve-devel
2024-12-05 15:47 ` Stefan Hanreich
2024-12-05 15:51 ` Lou Lecrivain via pve-devel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal