Skip to content

Commit

Permalink
fix: Delete config file after delete of app (#1766)
Browse files Browse the repository at this point in the history
  • Loading branch information
karolisg committed Jul 19, 2023
1 parent cdb3fd0 commit 33c8038
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions dozer-cli/src/cloud_app_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ impl CloudAppContext {
))
}

pub fn delete_config_file() -> Result<(), CloudContextError> {
let file_path = Self::get_file_path()?;
fs::remove_file(file_path)?;
Ok(())
}

pub fn get_app_id(config: &Option<Cloud>) -> Result<String, CloudContextError> {
match &config {
None => Err(AppIdNotFound),
Expand Down
8 changes: 6 additions & 2 deletions dozer-cli/src/simple/cloud_orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,19 @@ impl CloudOrchestrator for SimpleOrchestrator {
stop_app(&mut client, &app_id).await?;

steps.start_next_step();
let _delete_result = client
let delete_result = client
.delete_application(DeleteAppRequest {
app_id: app_id.clone(),
})
.await
.map_err(GRPCCallError)?
.into_inner();

steps.complete_step(Some(&format!("Deleted {}", &app_id)));
if delete_result.success {
steps.complete_step(Some(&format!("Deleted {}", &app_id)));

let _ = CloudAppContext::delete_config_file();
}

Ok::<(), CloudError>(())
})?;
Expand Down

0 comments on commit 33c8038

Please sign in to comment.