From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH common] fix #5607: json schema: describe the allowed characters of configuration IDs
Date: Thu, 26 Nov 2026 09:17:45 +0000 [thread overview]
Message-ID: <20261126091745.7-1-me@dualfroz.com> (raw)
An ID that does not match the pve-configid format, for example the name
of a resource mapping, is rejected with just "invalid configuration ID",
so users have to guess what is wrong with it. Spell out the rule in the
error message and add a test for it.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
tested with make check, the new test fails without the change
src/PVE/JSONSchema.pm | 3 ++-
test/format_test.pl | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 41210b7..5d2b7d4 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -256,7 +256,8 @@ sub pve_verify_configid {
if ($id !~ m/^$CONFIGID_RE\z/) {
return undef if $noerr;
- die "invalid configuration ID '$id'\n";
+ die "invalid configuration ID '$id' - must start with a letter and be followed by"
+ . " at least one letter, digit, '-' or '_'\n";
}
return $id;
}
diff --git a/test/format_test.pl b/test/format_test.pl
index 2b9460d..f2993a9 100755
--- a/test/format_test.pl
+++ b/test/format_test.pl
@@ -26,6 +26,9 @@ foreach my $id (@$invalid_configids) {
is(PVE::JSONSchema::pve_verify_configid($id, $noerr), undef, 'invalid configid');
}
+eval { PVE::JSONSchema::pve_verify_configid('1a') };
+like($@, qr/must start with a letter/, 'invalid configid error describes the allowed characters');
+
# test some string rendering
my $render_data = [
["timestamp", 0, undef, "1970-01-01 01:00:00"],
--
2.43.0
reply other threads:[~2026-11-26 9:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261126091745.7-1-me@dualfroz.com \
--to=me@dualfroz.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 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.