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
worker/undertaker: don't ignore all errors #7761
Conversation
state/undertaker.go
Outdated
// transitions the model to Dead. | ||
// | ||
// If the model is non-empty because it is the controller model and still | ||
// contains hosted models, an error satisfying IsHasHostedModelsError wll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing vowel in "will"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
// Error is part of the error interface. | ||
func (e modelNotEmptyError) Error() string { | ||
msg := "model not empty, found " | ||
plural := func(n int, thing string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice usability consideration :D
if model.UUID() != st.ModelUUID() && model.Life() != Dead { | ||
return nil, errors.Errorf("one or more hosted models are not yet dead") | ||
} | ||
if n := len(models) - 1; n > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AllModels() call above will return even those models that are already Dead. Do we want them to be part of this count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, per the comment I added: we shouldn't be able to mark the controller model as Dead until all hosted models are removed
The undertaker was ignoring all errors when attempting to transition a Dying model to Dead. This is wrong; we should only ignore a couple of specific errors relating to the contents of the model. After those errors are received, we'll retry. Other errors should cause the worker to restart. Possibly fixes https://bugs.launchpad.net/juju/+bug/1695894
ebec1cf
to
bf0de30
Compare
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
Description of change
The undertaker was ignoring all errors when attempting
to transition a Dying model to Dead. This is wrong; we
should only ignore a couple of specific errors relating
to the contents of the model. After those errors are
received, we'll retry. Other errors should cause the
worker to restart.
QA steps
Smoke test: bootstrap, add-machine, destroy-controller --destroy-all-models.
Documentation changes
None.
Bug reference
Possibly fixes https://bugs.launchpad.net/juju/+bug/1695894