Skip to content

Delete gracefully if user no longer exist in grafana#991

Merged
julienduchesne merged 1 commit intografana:masterfrom
pascal-hofmann:fail-gracefully-if-user-already-deleted
Aug 1, 2023
Merged

Delete gracefully if user no longer exist in grafana#991
julienduchesne merged 1 commit intografana:masterfrom
pascal-hofmann:fail-gracefully-if-user-already-deleted

Conversation

@pascal-hofmann
Copy link
Copy Markdown
Contributor

@pascal-hofmann pascal-hofmann commented Jul 27, 2023

When applying a terraform plan that was created with -refresh=false the detection of resources that no longer exist in grafana does not work, as the resources are not read at all.

Thus on apply, a deletion of a user that no longer exists in grafana fails with:

Error: status: 404, body: {"message":"user not found"}

This change modifies DeleteUser so that it catches this case and does not return an error.

@pascal-hofmann pascal-hofmann requested a review from a team July 27, 2023 19:05
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 27, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown
Contributor

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically. To do so, a Grafana Labs employee must promote the Drone build.

For maintainers, it's better to run only the Cloud tests you need, rather than all of them. You can do so by setting the following parameter when promoting:

TESTARGS='-run=<testname>'

@pascal-hofmann pascal-hofmann force-pushed the fail-gracefully-if-user-already-deleted branch 2 times, most recently from f37d858 to b8ea3e0 Compare July 27, 2023 19:08
@pascal-hofmann pascal-hofmann changed the title Delete gracefully if users no longer exist in grafana Delete gracefully if user no longer exist in grafana Jul 27, 2023
When applying a terraform plan that was created with `-refresh=false` the
detection of resources that no longer exist in grafana does not work,
as the resources are not read at all.

Thus on apply, a deletion of a user that no longer exists in grafana fails with:
```
Error: status: 404, body: {"message":"user not found"}
```

This change modifies `DeleteUser` so that it catches this case and does
not return an error.
@julienduchesne julienduchesne force-pushed the fail-gracefully-if-user-already-deleted branch from b8ea3e0 to ea58a03 Compare July 31, 2023 11:24
@julienduchesne julienduchesne merged commit 3bbf4fe into grafana:master Aug 1, 2023
@pascal-hofmann pascal-hofmann deleted the fail-gracefully-if-user-already-deleted branch August 1, 2023 11:48
@pascal-hofmann
Copy link
Copy Markdown
Contributor Author

Thank you for the quick review and merge! 🚀👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants