[pve-devel] [PATCH common 1/1] JSONSchema: extend pve-configid regex by '-'
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Apr 23 09:02:46 CEST 2020
On 4/23/20 8:44 AM, Wolfgang Bumiller wrote:
>
>> On April 23, 2020 7:56 AM Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:
>>
>>
>> On 4/9/20 4:10 PM, Dominik Csapak wrote:
>>> we use this format for all 'delete' options but we have some options
>>> that have a '-' in the name (e.g. 'sync-defaults-options') that cannot
>>> be deleted if it is not included
>>>
>>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>>> ---
>>> src/PVE/JSONSchema.pm | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
>>> index 01a3cce..1d28f36 100644
>>> --- a/src/PVE/JSONSchema.pm
>>> +++ b/src/PVE/JSONSchema.pm
>>> @@ -169,7 +169,7 @@ register_format('pve-configid', \&pve_verify_configid);
>>> sub pve_verify_configid {
>>> my ($id, $noerr) = @_;
>>>
>>> - if ($id !~ m/^[a-z][a-z0-9_]+$/i) {
>>> + if ($id !~ m/^[a-z][a-z0-9_-]+$/i) {
>>> return undef if $noerr;
>>> die "invalid configuration ID '$id'\n";
>>> }
>>
>> Fabian, Wolfgang: Any objection here? I think it should be OK, but we may
>> want to adapt the pve-container and qemu-server config parsers to accept
>> also the minus in keys, as it will be for sure sooner or later used there
>> then too. Quick-checking other parsers wouldn't hurt either. :)
>
> You know my answer ;-)
Yeah, but I do not want the "I wish for - separate keys" answer I want the
"does it break stuff we may not have noticed" answer ;-P
>
> Btw. those parsers are extremely similar and we could probably get away with
> one in guest-common (with a parameter for the pending section name) with
> either some post-processing or a callback for some things. A line callback
> might definitely be good to handle things like `lxc.*` raw keys.
>
Yes, the unifying our tons of mostly similar but still different parsers
would be great, Fabian and I had a few talks about that already. :)
> Oh and, neither accepts `-` in keys yet.
That's why I mentioned it here ^^
More information about the pve-devel
mailing list