Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3775316
D2990.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D2990.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 17:59 (16 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262923
Default Alt Text
D2990.diff (2 KB)
Attached To
Mode
D2990: Serialize RecipeStatus as HTTP response
Attached
Detach File
Event Timeline
Log In to Comment