From cb50d98884f786a3e2aa40befa6ebf1ef2be90da Mon Sep 17 00:00:00 2001 From: notgne2 Date: Sun, 22 Nov 2020 18:32:04 -0700 Subject: Use `/tmp` as temp directory, not `/tmp/deploy-rs` (resolves #8 by deprecation) --- README.md | 4 ++-- src/activate.rs | 2 +- src/utils/deploy.rs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7fc9484..bffa3de 100644 --- a/README.md +++ b/README.md @@ -163,8 +163,8 @@ This is a set of options that can be put in any of the above definitions, with t # This defaults to `true` magicRollback = true; - # The path which deploy-rs will use for temporary files, this is currently only used by `magicRollback` to create an inotify watcher in - # If not specified, this will default to `/tmp/deploy-rs` + # The path which deploy-rs will use for temporary files, this is currently only used by `magicRollback` to create an inotify watcher in for confirmations + # If not specified, this will default to `/tmp` # (if `magicRollback` is in use, this _must_ be writable by `user`) tempPath = "/home/someuser/.deploy-rs"; } diff --git a/src/activate.rs b/src/activate.rs index f9c7e22..193f617 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -204,7 +204,7 @@ pub async fn activation_confirmation( closure: String, ) -> Result<(), ActivationConfirmationError> { let lock_hash = &closure["/nix/store/".len()..]; - let lock_path = format!("{}/activating-{}", temp_path, lock_hash); + let lock_path = format!("{}/deploy-rs-canary-{}", temp_path, lock_hash); if let Some(parent) = Path::new(&lock_path).parent() { fs::create_dir_all(parent) diff --git a/src/utils/deploy.rs b/src/utils/deploy.rs index f88a115..adcde64 100644 --- a/src/utils/deploy.rs +++ b/src/utils/deploy.rs @@ -44,7 +44,7 @@ fn test_activation_command_builder() { let profile_path = "/blah/profiles/test"; let closure = "/blah/etc"; let auto_rollback = true; - let temp_path = &"/tmp/deploy-rs".into(); + let temp_path = &"/tmp".into(); let confirm_timeout = 30; let magic_rollback = true; @@ -59,7 +59,7 @@ fn test_activation_command_builder() { confirm_timeout, magic_rollback ), - "sudo -u test /blah/bin/activate '/blah/profiles/test' '/blah/etc' --temp-path /tmp/deploy-rs --confirm-timeout 30 --magic-rollback --auto-rollback" + "sudo -u test /blah/bin/activate '/blah/profiles/test' '/blah/etc' --temp-path /tmp --confirm-timeout 30 --magic-rollback --auto-rollback" .to_string(), ); } @@ -93,7 +93,7 @@ pub async fn deploy_profile( let temp_path: Cow = match &deploy_data.merged_settings.temp_path { Some(x) => x.into(), - None => "/tmp/deploy-rs".into(), + None => "/tmp".into(), }; let confirm_timeout = deploy_data.merged_settings.confirm_timeout.unwrap_or(30); @@ -153,7 +153,7 @@ pub async fn deploy_profile( } let lock_hash = &deploy_data.profile.profile_settings.path["/nix/store/".len()..]; - let lock_path = format!("{}/activating-{}", temp_path, lock_hash); + let lock_path = format!("{}/deploy-rs-canary-{}", temp_path, lock_hash); let mut confirm_command = format!("rm {}", lock_path); if let Some(sudo_cmd) = &deploy_defs.sudo { -- cgit v1.2.3