fix #5607: schema: say what a valid configuration ID looks like
The 'pve-configid' format is used for many IDs, for example the names of resource mappings, but an invalid ID only got rejected with: invalid configuration ID 'gpu@node1' which does not tell what is wrong with it, so users had to guess or look up the regex in the code. Explain the rules in the error message: an ID must start with a letter, be at least two characters long and only contain letters, digits, '-' and '_'. These are the same rules the tooltip of the 'ConfigId' validation in the web UI lists. Add a test for the message. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
927e892d87
commit
9373a6089b
2 files changed
+10
-1
No files matched your search
@@ -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' - it must start with a letter, be at least two"
|
||||
. " characters long and only contain letters, digits, '-' and '_'\n";
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user