public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-firewall v3] api: aliases: make cidr optional on update and preserve comment
@ 2026-10-15  5:45 Arthur Bied-Charreton
  2026-11-02 23:22 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Arthur Bied-Charreton @ 2026-10-15  5:45 UTC (permalink / raw)
  To: pve-devel

Updating an alias required passing its CIDR, and dropped the existing
comment unless it was passed again. Clients therefore had to fetch the
alias first just to send back the currently configured CIDR and comment.

Make 'cidr' optional in PUT .../firewall/aliases/{name} and keep the
existing CIDR and comment if none is passed. Passing an empty comment
still clears it.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/API2/Firewall/Aliases.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Firewall/Aliases.pm b/src/PVE/API2/Firewall/Aliases.pm
index 4f6960d..02835b3 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,8 +251,11 @@ sub register_update_alias {
 
                     raise_param_exc({ name => "no such alias" }) if !$aliases->{$name};
 
-                    my $data = { name => $param->{name}, cidr => $param->{cidr} };
-                    $data->{comment} = $param->{comment} if $param->{comment};
+                    my $data = {
+                        name => $param->{name},
+                        cidr => $param->{cidr} // $aliases->{$name}->{cidr},
+                        comment => $param->{comment} // $aliases->{$name}->{comment},
+                    };
 
                     $aliases->{$name} = $data;
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH pve-firewall v3] api: aliases: make cidr optional on update and preserve comment
  2026-10-15  5:45 [PATCH pve-firewall v3] api: aliases: make cidr optional on update and preserve comment Arthur Bied-Charreton
@ 2026-11-02 23:22 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-11-02 23:22 UTC (permalink / raw)
  To: pve-devel, Arthur Bied-Charreton

On Thu, 15 Oct 2026 07:45:34 +0200, Arthur Bied-Charreton wrote:
> Updating an alias required passing its CIDR, and dropped the existing
> comment unless it was passed again. Clients therefore had to fetch the
> alias first just to send back the currently configured CIDR and comment.
> 
> Make 'cidr' optional in PUT .../firewall/aliases/{name} and keep the
> existing CIDR and comment if none is passed. Passing an empty comment
> still clears it.
> 
> [...]

Applied, thanks!

[1/1] api: aliases: make cidr optional on update and preserve comment
      commit: 1bba92a1505a3ca9c69b853998e1f020cff1c8da




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-02 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15  5:45 [PATCH pve-firewall v3] api: aliases: make cidr optional on update and preserve comment Arthur Bied-Charreton
2026-11-02 23:22 ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal