From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH ha-manager 1/2] api: assert validity of resources param only if defined
Date: Tue, 24 Mar 2026 13:49:20 +0100 [thread overview]
Message-ID: <20260324124921.148515-2-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20260324124921.148515-1-m.koeppl@proxmox.com>
The check for the validity of the resources param should only be
performed if the param was even defined, since it is not a required
parameter for updating a rule. Previously, when not setting the
resources field as part of the request, the check in the assert
function would fail due to using undefined as a hash reference, which
would stop users from updating a rule.
Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
src/PVE/API2/HA/Rules.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/API2/HA/Rules.pm b/src/PVE/API2/HA/Rules.pm
index f09ab36..0b44d51 100644
--- a/src/PVE/API2/HA/Rules.pm
+++ b/src/PVE/API2/HA/Rules.pm
@@ -343,7 +343,7 @@ __PACKAGE__->register_method({
my $plugin = PVE::HA::Rules->lookup($type);
my $opts = $plugin->check_config($ruleid, $param, 0, 1);
- $assert_valid_resources_param->($opts->{resources});
+ $assert_valid_resources_param->($opts->{resources}) if $opts->{resources};
$assert_valid_nodes_param->($opts->{nodes}) if $opts->{nodes};
my $options = $plugin->private()->{options}->{$type};
--
2.47.3
next prev parent reply other threads:[~2026-03-24 12:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 12:49 [PATCH ha-manager 0/2] fix param check for rules updates and Michael Köppl
2026-03-24 12:49 ` Michael Köppl [this message]
2026-03-24 12:49 ` [PATCH ha-manager 2/2] format code with perltidy Michael Köppl
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=20260324124921.148515-2-m.koeppl@proxmox.com \
--to=m.koeppl@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