diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | interface.json | 3 | ||||
-rw-r--r-- | src/activate.rs | 43 | ||||
-rw-r--r-- | src/utils/data.rs | 1 | ||||
-rw-r--r-- | src/utils/deploy.rs | 11 |
5 files changed, 0 insertions, 61 deletions
@@ -33,9 +33,6 @@ This is the core of how `deploy-rs` was designed, any number of these can run on ```nix { - # The command to bootstrap your profile, this is optional - bootstrap = "mkdir xyz"; - # A derivation containing your required software, and a script to activate it in `${path}/activate` # For ease of use, `deploy-rs` provides a function to easy all this required activation script to any derivation # Both the working directory and `$PROFILE` will point to `profilePath` diff --git a/interface.json b/interface.json index fa45e50..57ab5b3 100644 --- a/interface.json +++ b/interface.json @@ -75,9 +75,6 @@ "path": { "type": "string" }, - "bootstrap": { - "type": "string" - }, "profilePath": { "type": "string" } diff --git a/src/activate.rs b/src/activate.rs index 71dca72..215c086 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -49,10 +49,6 @@ struct Opts { #[clap(long)] magic_rollback: bool, - /// Command for bootstrapping - #[clap(long)] - bootstrap_cmd: Option<String>, - /// Auto rollback if failure #[clap(long)] auto_rollback: bool, @@ -258,14 +254,6 @@ pub enum ActivateError { #[error("The command for setting profile resulted in a bad exit code: {0:?}")] SetProfileExitError(Option<i32>), - #[error("Failed to run bootstrap command: {0}")] - BootstrapError(std::io::Error), - #[error("The bootstrap command resulted in a bad exit code: {0:?}")] - BootstrapExitError(Option<i32>), - - #[error("Error removing profile after bootstrap failed: {0}")] - RemoveGenerationErr(std::io::Error), - #[error("Failed to execute the activation script: {0}")] RunActivateError(std::io::Error), #[error("The activation script resulted in a bad exit code: {0:?}")] @@ -281,7 +269,6 @@ pub enum ActivateError { pub async fn activate( profile_path: String, closure: String, - bootstrap_cmd: Option<String>, auto_rollback: bool, temp_path: String, confirm_timeout: u16, @@ -306,35 +293,6 @@ pub async fn activate( } }; - if let (Some(bootstrap_cmd), false) = (bootstrap_cmd, !Path::new(&profile_path).exists()) { - let bootstrap_status = Command::new("bash") - .arg("-c") - .arg(&bootstrap_cmd) - .env("PROFILE", &profile_path) - .status() - .await; - - match bootstrap_status { - Ok(s) => match s.code() { - Some(0) => {} - a => { - tokio::fs::remove_file(&profile_path) - .await - .map_err(ActivateError::RemoveGenerationErr)?; - - return Err(ActivateError::BootstrapExitError(a)); - } - }, - Err(err) => { - tokio::fs::remove_file(&profile_path) - .await - .map_err(ActivateError::RemoveGenerationErr)?; - - return Err(ActivateError::BootstrapError(err)); - } - } - } - let activate_status = match Command::new(format!("{}/deploy-rs-activate", profile_path)) .env("PROFILE", &profile_path) .current_dir(&profile_path) @@ -388,7 +346,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { match activate( opts.profile_path, opts.closure, - opts.bootstrap_cmd, opts.auto_rollback, opts.temp_path, opts.confirm_timeout, diff --git a/src/utils/data.rs b/src/utils/data.rs index 6cf2c5a..f557e41 100644 --- a/src/utils/data.rs +++ b/src/utils/data.rs @@ -45,7 +45,6 @@ pub struct NodeSettings { #[derive(Deserialize, Debug, Clone)] pub struct ProfileSettings { pub path: String, - pub bootstrap: Option<String>, #[serde(rename(deserialize = "profilePath"))] pub profile_path: Option<String>, } diff --git a/src/utils/deploy.rs b/src/utils/deploy.rs index f395a3a..44ffa1d 100644 --- a/src/utils/deploy.rs +++ b/src/utils/deploy.rs @@ -12,7 +12,6 @@ fn build_activate_command( sudo: &Option<String>, profile_path: &str, closure: &str, - bootstrap_cmd: &Option<String>, auto_rollback: bool, temp_path: &Cow<str>, confirm_timeout: u16, @@ -31,13 +30,6 @@ fn build_activate_command( self_activate_command = format!("{} --auto-rollback", self_activate_command); } - if let Some(ref bootstrap_cmd) = bootstrap_cmd { - self_activate_command = format!( - "{} --bootstrap-cmd '{}'", - self_activate_command, bootstrap_cmd - ); - } - if let Some(sudo_cmd) = &sudo { self_activate_command = format!("{} {}", sudo_cmd, self_activate_command); } @@ -51,7 +43,6 @@ fn test_activation_command_builder() { let sudo = Some("sudo -u test".to_string()); let profile_path = "/blah/profiles/test"; let closure = "/blah/etc"; - let bootstrap_cmd = None; let auto_rollback = true; let temp_path = &"/tmp/deploy-rs".into(); let confirm_timeout = 30; @@ -63,7 +54,6 @@ fn test_activation_command_builder() { &sudo, profile_path, closure, - &bootstrap_cmd, auto_rollback, temp_path, confirm_timeout, @@ -117,7 +107,6 @@ pub async fn deploy_profile( &deploy_defs.sudo, &deploy_defs.profile_path, &deploy_data.profile.profile_settings.path, - &deploy_data.profile.profile_settings.bootstrap, auto_rollback, &temp_path, confirm_timeout, |