as a single point where we get the type of upid status
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
return !($status eq 'OK' || $status =~ m/^WARNINGS: \d+$/);
}
+# takes the parsed status and returns the type,
+# either ok, warning, error or unknown
+sub upid_get_status_type {
+ my ($status) = @_;
+
+ if (!$status) {
+ return 'unknown';
+ }
+
+ if ($status eq 'OK') {
+ return 'ok';
+ } elsif ($status =~ m/^WARNINGS: \d+$/) {
+ return 'warning';
+ } elsif ($status eq 'unexpected status') {
+ return 'unknown';
+ } else {
+ return 'error';
+ }
+}
+
# useful functions to store comments in config files
sub encode_text {
my ($text) = @_;