4.1.0: Introduce a way to protect a virtual host from deletion (backport #13015) #13017
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Accidental "fat finger" virtual deletion accidents #12772 would be easier to avoid if there was a protection mechanism that would apply equally even to CLI tools and external applications that do not use confirmations for deletion operations.
This introduce the following changes:
DELETE /api/vhosts/{name}
was adapted to handle such blocked deletion attempts to respond with a 412 Precondition Failed statusrabbitmqctl list_vhosts
andrabbitmqctl delete_vhost
were adapted accordinglyDELETE /api/vhosts/{name}/deletion/protection
is a new endpoint that can be used to remove the protective seal (the metadata key)POST /api/vhosts/{name}/deletion/protection
marks the virtual host as protectedIn the case of the HTTP API, all operations on
virtual host metadata require administrative
privileges.
Other considerations:
Closes #12772.
This is an automatic backport of pull request #13015 done by [Mergify](https://mergify.com).