diff options
author | Oleg Pykhalov | 2021-04-16 10:28:01 +0300 |
---|---|---|
committer | Oleg Pykhalov | 2021-04-16 12:38:37 +0300 |
commit | 920c9d2ed4034e2200c948868c7bd510e58b1371 (patch) | |
tree | 2737004639587c3713b92f6f00fa7be99b9d9f38 | |
parent | 6093dc02e98ae68f73c997c8d5d18f19074a46e1 (diff) |
Apply notgne2 suggestions.
-rw-r--r-- | flake.nix | 16 | ||||
-rw-r--r-- | src/bin/activate.rs | 4 | ||||
-rw-r--r-- | src/deploy.rs | 6 |
3 files changed, 11 insertions, 15 deletions
@@ -61,14 +61,11 @@ activate = rec { custom = { - __toString = customSelf: "TODO: dryActivate"; __functor = customSelf: base: activate: pkgs.buildEnv { name = ("activatable-" + base.name); paths = - let - hasDryActivate = builtins.hasAttr "dryActivate" customSelf; - in [ + [ base (pkgs.writeTextFile { name = base.name + "-activate-path"; @@ -78,12 +75,11 @@ if [[ $DRY_ACTIVATE == "1" ]] then - if ${pkgs.lib.boolToString hasDryActivate} - then - ${if hasDryActivate then customSelf.dryActivate else ":"} - else - echo ${pkgs.writeScript "activate" activate} - fi + ${if builtins.hasAttr "dryActivate" customSelf + then + customSelf.dryActivate + else + "echo ${pkgs.writeScript "activate" activate}"} else ${activate} fi diff --git a/src/bin/activate.rs b/src/bin/activate.rs index 73d064f..da53174 100644 --- a/src/bin/activate.rs +++ b/src/bin/activate.rs @@ -378,9 +378,9 @@ pub async fn activate( debug!("Running activation script"); let activate_status = match Command::new(format!("{}/deploy-rs-activate", profile_path)) - .env("PROFILE", &closure) + .env("PROFILE", if dry_activate { &closure } else { &profile_path }) .env("DRY_ACTIVATE", if dry_activate { "1" } else { "0" }) - .current_dir(&closure) + .current_dir(if dry_activate { &closure } else { &profile_path }) .status() .await .map_err(ActivateError::RunActivateError) diff --git a/src/deploy.rs b/src/deploy.rs index f6cd4ef..285bbbd 100644 --- a/src/deploy.rs +++ b/src/deploy.rs @@ -237,8 +237,6 @@ pub async fn deploy_profile( let auto_rollback = deploy_data.merged_settings.auto_rollback.unwrap_or(true); - let dry_activate = dry_activate; - let self_activate_command = build_activate_command(ActivateCommandData { sudo: &deploy_defs.sudo, profile_path: &deploy_defs.profile_path, @@ -280,7 +278,9 @@ pub async fn deploy_profile( a => return Err(DeployProfileError::SSHActivateExitError(a)), }; - if !dry_activate { + if dry_activate { + info!("Completed dry-activate!"); + } else { info!("Success activating, done!"); } } else { |