[pve-devel] [PATCH common 1/1] JSONSchema: add pve-tag format

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 23 17:30:35 CEST 2019


On 9/10/19 2:57 PM, Dominik Csapak wrote:
> useful for vm/ct tags

a short sentence which describes the format would be appreciated..
Also, I'd like to keep format registrations here relatively minimal,
I mean they do not need to have the wide spread use all over our
projects like default options need to have, but still...

Do you have any known places where you would use that too, now or
in the near future? Else I'd maybe put this into guest-common.

Short hint that this is intended to be used as "tag-list" format, so
that multiple tags are done through our "magic" -list format extension
allowing to pass multiple comma-separated format values.

> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/PVE/JSONSchema.pm | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index db38d44..e221dce 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -499,6 +499,17 @@ register_standard_option('bwlimit', {
>      format => $bwlimit_format,
>  });
>  
> +register_format('pve-tag', \&pve_verify_tag);
> +sub pve_verify_tag {
> +    my ($value, $noerr) = @_;
> +
> +    return $value if $value =~ m/^\w[\w\-\+\.]*$/;
> +
> +    return undef if $noerr;
> +
> +    die "invalid characters in tag\n";
> +}
> +
>  sub pve_parse_startup_order {
>      my ($value) = @_;
>  
> 





More information about the pve-devel mailing list