aboutsummaryrefslogtreecommitdiff
path: root/src/utils/deploy.rs
diff options
context:
space:
mode:
authornotgne22020-09-28 15:45:53 -0700
committernotgne22020-09-28 15:45:53 -0700
commit239d0f8999b47e9e76589ee1fa2d9f3459c47335 (patch)
treed9fa64da2385dcb3cf254a92e00fa92d2431c155 /src/utils/deploy.rs
parenta22063343e54da9f589c7235f2f64b57fe5c257b (diff)
use separate binary for activation, more cleanup
Diffstat (limited to '')
-rw-r--r--src/utils/deploy.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/utils/deploy.rs b/src/utils/deploy.rs
index 900743c..42bd0b4 100644
--- a/src/utils/deploy.rs
+++ b/src/utils/deploy.rs
@@ -9,6 +9,7 @@ pub async fn deploy_profile(
node_name: &str,
merged_settings: &data::GenericSettings,
deploy_data: &super::DeployData<'_>,
+ auto_rollback: bool,
) -> Result<(), Box<dyn std::error::Error>> {
info!(
"Activating profile `{}` for node `{}`",
@@ -16,8 +17,16 @@ pub async fn deploy_profile(
);
let mut self_activate_command = format!(
- "{} activate '{}' '{}'",
- deploy_data.current_exe.as_path().to_str().unwrap(),
+ "{} '{}' '{}'",
+ deploy_data
+ .current_exe
+ .as_path()
+ .parent()
+ .unwrap()
+ .to_str()
+ .unwrap()
+ .to_owned()
+ + "/activate",
deploy_data.profile_path,
profile.profile_settings.path,
);
@@ -40,6 +49,10 @@ pub async fn deploy_profile(
);
}
+ if auto_rollback {
+ self_activate_command = format!("{} --auto-rollback", self_activate_command);
+ }
+
let mut c = Command::new("ssh");
let mut ssh_command = c.arg(format!(
"ssh://{}@{}",