aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotgne22020-10-25 13:15:35 -0700
committernotgne22020-10-25 13:15:35 -0700
commit155f4bf45204b3090cc07271d2648ac7c024bbd1 (patch)
tree440a80ad8db012d09b2e561ea50925d7ef4a1bd8
parent73d14d456f288b98b9e0874d74a5a48d8a86e2b7 (diff)
Fail correctly if initial activation fails
Diffstat (limited to '')
-rw-r--r--src/activate.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/activate.rs b/src/activate.rs
index 55ceb27..4fdb59c 100644
--- a/src/activate.rs
+++ b/src/activate.rs
@@ -114,7 +114,7 @@ pub async fn deactivate(profile_path: &str) -> Result<(), Box<dyn std::error::Er
good_panic!("Failed to delete failed generation");
}
- info!("Attempting re-activate last generation");
+ info!("Attempting to re-activate the last generation");
let re_activate_exit_status = Command::new(format!("{}/deploy-rs-activate", profile_path))
.env("PROFILE", &profile_path)
@@ -255,11 +255,13 @@ pub async fn activate(
.status()
.await;
- match activate_status {
- Ok(s) if s.success() => (),
- _ if auto_rollback => return Ok(deactivate(&profile_path).await?),
- _ => (),
- }
+ let activate_status_all = match activate_status {
+ Ok(s) if s.success() => Ok(()),
+ Ok(_) => Err(std::io::Error::new(std::io::ErrorKind::Other, "Activation did not succeed")),
+ Err(x) => Err(x),
+ };
+
+ deactivate_on_err(&profile_path, activate_status_all).await;
info!("Activation succeeded!");