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

Dominik Csapak d.csapak at proxmox.com
Tue Sep 10 14:57:13 CEST 2019


useful for vm/ct tags

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) = @_;
 
-- 
2.20.1





More information about the pve-devel mailing list