* [PATCH pve-firewall v2] api: aliases: make 'cidr' optional when updating
@ 2026-09-29 13:25 Arthur Bied-Charreton
2026-10-14 15:30 ` Stefan Hanreich
0 siblings, 1 reply; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-09-29 13:25 UTC (permalink / raw)
To: pve-devel
Updating an alias required passing its CIDR, even when only renaming it.
Clients therefore had to fetch the alias first just to send back the
currently configured CIDR.
Make 'cidr' optional in PUT .../firewall/aliases/{name} and keep the
existing CIDR if none is passed.
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
changes since v1:
- fix subject line
src/PVE/API2/Firewall/Aliases.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/PVE/API2/Firewall/Aliases.pm b/src/PVE/API2/Firewall/Aliases.pm
index 4f6960d..9fd1348 100644
--- a/src/PVE/API2/Firewall/Aliases.pm
+++ b/src/PVE/API2/Firewall/Aliases.pm
@@ -215,7 +215,7 @@ sub register_update_alias {
$properties->{name} = $api_properties->{name};
$properties->{rename} = $api_properties->{rename};
- $properties->{cidr} = $api_properties->{cidr};
+ $properties->{cidr} = { $api_properties->{cidr}->%*, optional => 1 };
$properties->{comment} = $api_properties->{comment};
$properties->{digest} = get_standard_option('pve-config-digest');
@@ -251,7 +251,10 @@ sub register_update_alias {
raise_param_exc({ name => "no such alias" }) if !$aliases->{$name};
- my $data = { name => $param->{name}, cidr => $param->{cidr} };
+ my $data = {
+ name => $param->{name},
+ cidr => $param->{cidr} // $aliases->{$name}->{cidr},
+ };
$data->{comment} = $param->{comment} if $param->{comment};
$aliases->{$name} = $data;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH pve-firewall v2] api: aliases: make 'cidr' optional when updating
2026-09-29 13:25 [PATCH pve-firewall v2] api: aliases: make 'cidr' optional when updating Arthur Bied-Charreton
@ 2026-10-14 15:30 ` Stefan Hanreich
2026-10-15 5:46 ` superseded: " Arthur Bied-Charreton
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hanreich @ 2026-10-14 15:30 UTC (permalink / raw)
To: Arthur Bied-Charreton; +Cc: pve-devel
> @@ -251,7 +251,10 @@ sub register_update_alias {
>
> raise_param_exc({ name => "no such alias" }) if !$aliases->{$name};
>
> - my $data = { name => $param->{name}, cidr => $param->{cidr} };
> + my $data = {
> + name => $param->{name},
> + cidr => $param->{cidr} // $aliases->{$name}->{cidr},
> + };
> $data->{comment} = $param->{comment} if $param->{comment};
The comment here gets overwritten when updating the cidr, also when
renaming.
--
Stefan Hanreich <s.hanreich@proxmox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* superseded: [PATCH pve-firewall v2] api: aliases: make 'cidr' optional when updating
2026-10-14 15:30 ` Stefan Hanreich
@ 2026-10-15 5:46 ` Arthur Bied-Charreton
0 siblings, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-15 5:46 UTC (permalink / raw)
To: Stefan Hanreich; +Cc: pve-devel
On Wed, Oct 14, 2026 at 05:30:08PM +0200, Stefan Hanreich wrote:
> > @@ -251,7 +251,10 @@ sub register_update_alias {
> >
> > raise_param_exc({ name => "no such alias" }) if !$aliases->{$name};
> >
> > - my $data = { name => $param->{name}, cidr => $param->{cidr} };
> > + my $data = {
> > + name => $param->{name},
> > + cidr => $param->{cidr} // $aliases->{$name}->{cidr},
> > + };
> > $data->{comment} = $param->{comment} if $param->{comment};
>
> The comment here gets overwritten when updating the cidr, also when
> renaming.
>
true, thanks for noticing that!
superseded by:
https://lore.proxmox.com/pve-devel/20261015054534.25978-1-a.bied-charreton@proxmox.com/T/#u
> --
> Stefan Hanreich <s.hanreich@proxmox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-15 5:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 13:25 [PATCH pve-firewall v2] api: aliases: make 'cidr' optional when updating Arthur Bied-Charreton
2026-10-14 15:30 ` Stefan Hanreich
2026-10-15 5:46 ` superseded: " Arthur Bied-Charreton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox