Skip to content

Commit

Permalink
fix: do not delete non-existing dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
pb82 committed Apr 23, 2024
1 parent aa532c3 commit 616e2f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions controllers/dashboard_controller.go
Expand Up @@ -305,10 +305,14 @@ func (r *GrafanaDashboardReconciler) onDashboardDeleted(ctx context.Context, nam
resp, err := grafanaClient.Dashboards.GetDashboardByUID(*uid)
if err != nil {
var notFound *dashboards.GetDashboardByUIDNotFound
if !errors.As(err, &notFound) {
return err
if errors.As(err, &notFound) {
// nothing to do if the dashboard doesn't exist
return nil
}

return err
}

dash := resp.GetPayload()

_, err = grafanaClient.Dashboards.DeleteDashboardByUID(*uid) //nolint:errcheck
Expand Down

0 comments on commit 616e2f8

Please sign in to comment.