public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH] api: aliases: make 'cidr' optional when updating
Date: Tue, 29 Sep 2026 15:23:46 +0200	[thread overview]
Message-ID: <20260929132346.478117-1-a.bied-charreton@proxmox.com> (raw)

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>
---
 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





             reply	other threads:[~2026-09-29 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 13:23 Arthur Bied-Charreton [this message]
2026-09-29 13:26 ` superseded: [PATCH] api: aliases: make 'cidr' optional when updating Arthur Bied-Charreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929132346.478117-1-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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