Page MenuHomeDevCentral

D2990.id7641.diff
No OneTemporary

D2990.id7641.diff

diff --git a/src/runner/mod.rs b/src/runner/mod.rs
--- a/src/runner/mod.rs
+++ b/src/runner/mod.rs
@@ -11,6 +11,7 @@
use std::process::{Command, Stdio};
use log::{error, info, warn};
+use serde::Serialize;
// -------------------------------------------------------------
// Modules
@@ -26,6 +27,7 @@
// those exit code inspired by the Nagios one.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+#[derive(Debug, Serialize)]
pub enum RecipeStatus {
Success,
Warning,
diff --git a/src/server/requests.rs b/src/server/requests.rs
--- a/src/server/requests.rs
+++ b/src/server/requests.rs
@@ -12,6 +12,7 @@
use crate::actions;
use crate::config::AlkaneConfig;
+use crate::runner::RecipeStatus;
// -------------------------------------------------------------
// Monitoring
@@ -36,7 +37,7 @@
site_name: String,
context: String,
config: State<AlkaneConfig>,
-) -> ApiJsonResponse<bool> {
+) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
let context = if context.is_empty() {
@@ -47,11 +48,11 @@
debug!("Context: {:?}", &context);
match actions::initialize(&site_name, context, &config) {
- Ok(_) => true.into_json_response(),
+ Ok(status) => status.into_json_response(),
Err(error) => {
warn!("Deployment error: {:?}", error);
- false.into_json_response()
+ RecipeStatus::Error.into_json_response()
}
}
}
@@ -61,7 +62,7 @@
site_name: String,
context: String,
config: State<AlkaneConfig>,
-) -> ApiJsonResponse<bool> {
+) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
let context = if context.is_empty() {
@@ -72,11 +73,11 @@
debug!("Context: {:?}", &context);
match actions::update(&site_name, context, &config) {
- Ok(_) => true.into_json_response(),
+ Ok(status) => status.into_json_response(),
Err(error) => {
warn!("Deployment error: {:?}", error);
- false.into_json_response()
+ RecipeStatus::Error.into_json_response()
}
}
}
@@ -86,7 +87,7 @@
site_name: String,
context: String,
config: State<AlkaneConfig>,
-) -> ApiJsonResponse<bool> {
+) -> ApiJsonResponse<RecipeStatus> {
info!("Deploying {}", &site_name);
let context = if context.is_empty() {
@@ -97,11 +98,11 @@
debug!("Context: {:?}", &context);
match actions::deploy(&site_name, context, &config) {
- Ok(_) => true.into_json_response(),
+ Ok(status) => status.into_json_response(),
Err(error) => {
warn!("Deployment error: {:?}", error);
- false.into_json_response()
+ RecipeStatus::Error.into_json_response()
}
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 18:25 (22 h, 40 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2180889
Default Alt Text
D2990.id7641.diff (2 KB)

Event Timeline