diff options
Diffstat (limited to '')
-rw-r--r-- | src/utils/deploy.rs | 2 | ||||
-rw-r--r-- | src/utils/mod.rs | 26 | ||||
-rw-r--r-- | src/utils/push.rs | 8 |
3 files changed, 13 insertions, 23 deletions
diff --git a/src/utils/deploy.rs b/src/utils/deploy.rs index a82fa6c..b37909e 100644 --- a/src/utils/deploy.rs +++ b/src/utils/deploy.rs @@ -89,7 +89,7 @@ pub async fn deploy_profile( deploy_data.profile_name, deploy_data.node_name ); - let activate_path_str = super::deploy_path_to_activate_path_str(&deploy_defs.current_exe)?; + let activate_path_str = super::deploy_path_to_activate_path_str(deploy_defs)?; let temp_path: Cow<str> = match &deploy_data.merged_settings.temp_path { Some(x) => x.into(), diff --git a/src/utils/mod.rs b/src/utils/mod.rs index deea78e..6052813 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -197,7 +197,6 @@ pub struct DeployDefs { pub ssh_user: String, pub profile_user: String, pub profile_path: String, - pub current_exe: PathBuf, pub sudo: Option<String>, } @@ -258,7 +257,6 @@ impl<'a> DeployData<'a> { ssh_user, profile_user, profile_path, - current_exe, sudo, }) } @@ -316,25 +314,21 @@ pub enum DeployPathToActivatePathError { } pub fn deploy_path_to_activate_path_str( - deploy_path: &std::path::Path, + deploy_defs: &DeployDefs, ) -> Result<String, DeployPathToActivatePathError> { - Ok(format!( - "{}/activate", - deploy_path - .parent() - .ok_or(DeployPathToActivatePathError::PathTooShort)? - .to_str() - .ok_or(DeployPathToActivatePathError::InvalidUtf8)? - .to_owned() - )) + Ok(format!("{}/activate-rs", deploy_defs.profile_path)) } #[test] fn test_activate_path_generation() { - match deploy_path_to_activate_path_str(&std::path::PathBuf::from( - "/blah/blah/deploy-rs/bin/deploy", - )) { + let defs = DeployDefs { + ssh_user: "foo".to_string(), + profile_user: "bar".to_string(), + profile_path: "/nix/store/profile-closure".to_string(), + sudo: None, + }; + match deploy_path_to_activate_path_str(&defs) { Err(_) => panic!(""), - Ok(x) => assert_eq!(x, "/blah/blah/deploy-rs/bin/activate".to_string()), + Ok(x) => assert_eq!(x, "/nix/store/profile-closure/activate-rs".to_string()), } } diff --git a/src/utils/push.rs b/src/utils/push.rs index 342cd65..2dd408b 100644 --- a/src/utils/push.rs +++ b/src/utils/push.rs @@ -99,9 +99,7 @@ pub async fn push_profile( .arg("-k") .arg(local_key) .arg(&deploy_data.profile.profile_settings.path) - .arg(&super::deploy_path_to_activate_path_str( - &deploy_defs.current_exe, - )?) + .arg(&super::deploy_path_to_activate_path_str(&deploy_defs)?) .status() .await .map_err(PushProfileError::SignError)?; @@ -146,9 +144,7 @@ pub async fn push_profile( .arg("--to") .arg(format!("ssh://{}@{}", deploy_defs.ssh_user, hostname)) .arg(&deploy_data.profile.profile_settings.path) - .arg(&super::deploy_path_to_activate_path_str( - &deploy_defs.current_exe, - )?) + .arg(&super::deploy_path_to_activate_path_str(&deploy_defs)?) .env("NIX_SSHOPTS", ssh_opts_str) .status() .await |