Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not delete non-existing dashboard #1504

Merged
merged 1 commit into from Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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