From bba8b2274fb801fb0e563d4c1dde2b08e2f25c21 Mon Sep 17 00:00:00 2001 From: oluceps Date: Sun, 15 Sep 2024 18:38:18 +0800 Subject: [PATCH] + --- src/cmd/deploy.rs | 12 +++++++++--- src/cmd/stored_sec_path.rs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index ffd0773..d8f7776 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -75,8 +75,8 @@ impl Profile { } Ok(res) => { info!("found mountpoint generation {}", res); - if res > max { - max = res; + if res >= max { + max = res + 1; } } } @@ -144,8 +144,14 @@ impl Profile { .expect("write decrypted file error") }); + let _ = fs::remove_file(self.get_decrypt_dir_path()); // link back to /run/vaultix - std::os::unix::fs::symlink(target_extract_dir_with_gen, self.get_decrypt_dir_path()) + if std::os::unix::fs::symlink(target_extract_dir_with_gen, self.get_decrypt_dir_path()) .wrap_err("create symlink error") + .is_ok() + { + info!("deploy secrets success"); + } + Ok(()) } } diff --git a/src/cmd/stored_sec_path.rs b/src/cmd/stored_sec_path.rs index ea51f60..d47b43b 100644 --- a/src/cmd/stored_sec_path.rs +++ b/src/cmd/stored_sec_path.rs @@ -57,7 +57,7 @@ impl StoredSecretPath { debug!("identity hash: {}", ident_hash); let mut storage_dir_path = PathBuf::from(storage_dir_store); - info!("storage dir path prefix: {:?}", storage_dir_path); + debug!("storage dir path prefix: {:?}", storage_dir_path); storage_dir_path.push(format!("{}-{}.age", ident_hash, name)); storage_dir_path };