From 139288053915caeaab7d773cd7bc8b7eec211053 Mon Sep 17 00:00:00 2001 From: Iulian Barbu Date: Thu, 29 Jun 2023 17:49:38 +0100 Subject: [PATCH] provisioner: improve access key file path creation --- provisioner/src/lib.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/provisioner/src/lib.rs b/provisioner/src/lib.rs index 9e215dcf9..a5e639f69 100644 --- a/provisioner/src/lib.rs +++ b/provisioner/src/lib.rs @@ -838,15 +838,12 @@ impl DynamoDBHandler { } fn get_access_key_file_name(&self) -> String { - format!( - "{}{}.txt", - self.provisioner_state - .as_path() - .as_os_str() - .to_str() - .expect("to have a valid utf8 filename"), - self.prefix - ) + let mut access_key_file_path = self.provisioner_state.clone(); + access_key_file_path.push(self.prefix.clone()); + access_key_file_path + .to_str() + .expect("to have a valid access key file name") + .to_string() } async fn delete_saved_access_key(&self) -> Result<(), std::io::Error> { @@ -969,7 +966,7 @@ mod tests { "fqdn".to_string(), "pg".to_string(), "mongodb".to_string(), - PathBuf::from("."), + TempDir::new().unwrap().into_path(), ) .await .unwrap()