Skip to content

Commit

Permalink
fix: gracfully delete secondary dns record
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed May 31, 2024
1 parent 4f65dc2 commit 8827e26
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions svc/pkg/cluster/worker/src/workers/server_dns_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,23 @@ async fn inner(

// Delete secondary record
if let Some(record_id) = secondary_dns_record_id {
client
let res = client
.request(&cf::dns::DeleteDnsRecord {
zone_identifier: zone_id,
identifier: &record_id,
})
.await?;
.await;

tracing::info!(%record_id, "deleted secondary dns record");
if let Err(cf_framework::response::ApiFailure::Error(
http::status::StatusCode::NOT_FOUND,
_,
)) = res
{
tracing::warn!(%zone_id, %record_id, "secondary dns record not found");
} else {
res?;
tracing::info!(%record_id, "deleted secondary dns record");
}
} else {
tracing::warn!("server has no secondary dns record");
}
Expand Down

0 comments on commit 8827e26

Please sign in to comment.