]> git.proxmox.com Git - pve-common.git/commitdiff
JSONSchema: add pve-tag format
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 3 Oct 2019 11:50:07 +0000 (13:50 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Oct 2019 07:43:43 +0000 (08:43 +0100)
this will be used for vm/ct tag-lists, so that (config) management systems
or similar add additional information that does not reside in the
description

putting it here, since we want to eventually have it also for
nodes,storages,etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/JSONSchema.pm

index a144d5516b2ab698679a01c378a0b42059c79d57..51c3881f164d64be709cdf77ac0091f8501c5ed1 100644 (file)
@@ -499,6 +499,18 @@ register_standard_option('bwlimit', {
     format => $bwlimit_format,
 });
 
+# used for pve-tag-list in e.g., guest configs
+register_format('pve-tag', \&pve_verify_tag);
+sub pve_verify_tag {
+    my ($value, $noerr) = @_;
+
+    return $value if $value =~ m/^[a-z0-9_][a-z0-9_\-\+\.]*$/i;
+
+    return undef if $noerr;
+
+    die "invalid characters in tag\n";
+}
+
 sub pve_parse_startup_order {
     my ($value) = @_;