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.
This closes #1595
Summary Of Changes
Previously all actions in preStop hook were performed independently of each other. For example, drain would kick in even if queue sinchronization returned an error. This resulted in cases where graceful shutdown was assumed just because last action in the script, i.e.
rabbitmq-upgrade drain
, is a success.Now all actions in the hook actually waits for the previous action to complete successfully. The only exception is checking for the deletion marker file. Script will still exit with 0 (and shutdown will continue) if the marker is present without executing other actions.
Local Testing
I'm not familiar with Go and I don't have development environment to test these changes, sorry. This is just a friendly PR from a fellow sys admin. I'm also not sure if ampersands in Go strings need to be escaped to actually achieve
&&
in the final preStop hook. I did test the final script by manually modifying preStop hook on my local RabbitMQ environment, though.