Skip to content

Commit

Permalink
Unregister cluster when dropped through the shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Westwooo committed Aug 13, 2024
1 parent 62f517c commit aef950d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/cli/clusters_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn clusters_drop(

debug!("Running clusters drop for {}", &name);

let guard = state.lock().unwrap();
let mut guard = state.lock().unwrap();
let control = if let Some(c) = capella {
guard.get_capella_org(c)
} else {
Expand Down Expand Up @@ -103,5 +103,17 @@ fn clusters_drop(
.delete_cluster(org_id, project_id, cluster.id(), deadline, ctrl_c)
.map_err(|e| client_error_to_shell_error(e, span))?;

let identifier = {
guard
.clusters()
.iter()
.find(|c| c.1.hostnames().contains(&cluster.connection_string()))
.map(|registered| registered.0.clone())
};

if let Some(id) = identifier {
guard.remove_cluster(id);
}

Ok(PipelineData::empty())
}

0 comments on commit aef950d

Please sign in to comment.