Skip to content

Commit

Permalink
provisioner: improve access key file path creation
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianbarbu committed Jun 29, 2023
1 parent 321fc4d commit 530b254
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions provisioner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -947,7 +944,7 @@ fn engine_to_port(engine: aws_rds::Engine) -> String {

#[cfg(test)]
mod tests {
use std::{path::PathBuf, time::Duration};
use std::time::Duration;

use aws_sdk_dynamodb::types::{
AttributeDefinition, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType,
Expand All @@ -969,7 +966,7 @@ mod tests {
"fqdn".to_string(),
"pg".to_string(),
"mongodb".to_string(),
PathBuf::from("."),
TempDir::new().unwrap().into_path(),
)
.await
.unwrap()
Expand Down

0 comments on commit 530b254

Please sign in to comment.