[pve-devel] [PATCH common 1/9] tools: add upid_status_is_error function
Fabian Ebner
f.ebner at proxmox.com
Wed May 12 14:32:50 CEST 2021
There's also support for ending a task with warnings now, so the logic "status
not 'OK' means error" does not work anymore.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
src/PVE/Tools.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 16ae3d2..6f205df 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1165,6 +1165,14 @@ sub upid_read_status {
return "unable to read tail (got $br bytes)";
}
+# Check if the status returned by upid_read_status is an error status.
+# If the status could not be parsed it's also treated as an error.
+sub upid_status_is_error {
+ my ($status) = @_;
+
+ return !($status eq 'OK' || $status =~ m/^WARNINGS: \d+$/);
+}
+
# useful functions to store comments in config files
sub encode_text {
my ($text) = @_;
--
2.20.1
More information about the pve-devel
mailing list