[pmg-devel] [PATCH common 1/2] PVE/JSONSchema: add pve-task-status-type
Dominik Csapak
d.csapak at proxmox.com
Thu Jun 24 09:10:10 CEST 2021
to have a format that contains the possible worker task states
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/JSONSchema.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index 6297fff..71df690 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -689,6 +689,18 @@ sub pve_verify_tfa_secret {
die "unable to decode TFA secret\n";
}
+
+PVE::JSONSchema::register_format('pve-task-status-type', \&verify_task_status_type);
+sub verify_task_status_type {
+ my ($value, $noerr) = @_;
+
+ return $value if $value =~ m/^(ok|error|warning|unknown)$/i;
+
+ return undef if $noerr;
+
+ die "invalid status '$value'\n";
+}
+
sub check_format {
my ($format, $value, $path) = @_;
--
2.20.1
More information about the pmg-devel
mailing list