Make all model watcher more robust #7272

Merged
merged 1 commit into from Apr 24, 2017

Conversation

Projects
None yet
3 participants
Owner

wallyworld commented Apr 24, 2017

Description of change

Dead models might, in some circumstances, not have settings or other dependent documents still in the state database. The all model watcher handles this by treating it as if the model is removed from the backing state.

QA steps

Hard to validate exact fix as dead models without settings required db pokery, so regression test.

  • bootstrap and check GUI handles model change/deletion

Bug reference

https://bugs.launchpad.net/juju/+bug/1685321

mjs approved these changes Apr 24, 2017

Cheers

state/allwatcher.go
@@ -119,6 +119,11 @@ type backingModel modelDoc
func (e *backingModel) updated(st *State, store *multiwatcherStore, id string) error {
cfg, err := st.ModelConfig()
+ // Treat a not found error here as if the model has been removed.
+ // This will be the case if the model has been marked dead, pending cleanup.
+ if errors.IsNotFound(err) && e.Life == Dead {
@mjs

mjs Apr 24, 2017

Contributor

make a helper for this? Then the comment doesn't need to be repeated each time either. Something like ifNotFoundAndModelDead(err, e)

Owner

wallyworld commented Apr 24, 2017

$$merge$$

Contributor

jujubot commented Apr 24, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit a913949 into juju:develop Apr 24, 2017

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