server/worker_task: add tasktype to return the api type of a taskstate
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
038ee59960
commit
fa31f4c54c
|
@ -22,7 +22,7 @@ use crate::buildcfg;
|
|||
use crate::server;
|
||||
use crate::tools::logrotate::{LogRotate, LogRotateFiles};
|
||||
use crate::tools::{FileLogger, FileLogOptions};
|
||||
use crate::api2::types::Authid;
|
||||
use crate::api2::types::{Authid, TaskStateType};
|
||||
|
||||
macro_rules! taskdir {
|
||||
($subdir:expr) => (concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/tasks", $subdir))
|
||||
|
@ -242,6 +242,15 @@ impl TaskState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn tasktype(&self) -> TaskStateType {
|
||||
match self {
|
||||
TaskState::OK { .. } => TaskStateType::OK,
|
||||
TaskState::Unknown { .. } => TaskStateType::Unknown,
|
||||
TaskState::Error { .. } => TaskStateType::Error,
|
||||
TaskState::Warning { .. } => TaskStateType::Warning,
|
||||
}
|
||||
}
|
||||
|
||||
fn result_text(&self) -> String {
|
||||
match self {
|
||||
TaskState::Error { message, .. } => format!("TASK ERROR: {}", message),
|
||||
|
|
Loading…
Reference in New Issue