In a production controller, we encountered a model which was missing a settings document. This meant that:
a) the all-watcher couldn't start, because backingModel.updated fails if ModelConfig for the model fails, which is the case when there's no settings document
b) juju list-models fails because the settings can't be found for the model (it actually succeeds in getting details of all the other models, but doesn't print any of their details because of the one failure)
There are two issues here:
1) how we could have ended up in a state with a model with no associated settings document
2) make backingModel.updated more resilient in this case so we can start the all-watcher anyway.
For the record, the model had been marked as dead for a couple months before this issue arose.
This was its entry in the database:
{ "_id" : "c8b676d5-0090-46c6-8823-e372154de20e", "name" : "mymodel7", "life" : 2, "owner" : "frankban@external", "controller-uuid" : "5392879a-6c3b-47f8-8bd4-cec06c2a1c4d", "migration-mode" : "", "cloud" : "aws", "cloud-region" : "eu-central-1", "cloud-credential" : "aws/frankban@external/aws", "txn-revno" : NumberLong(4), "txn-queue" : [ "589e89e07a067a4c5589cda9_4f5b51a2", "589e89e47a067a4c5589d113_99c4b867", "589e89e57a067a4c5589d19e_187438bc", "589e89e67a067a4c5589d269_b0a3e379", "589e89e87a067a4c5589d325_cb0211f9", "589e89e97a067a4c5589d447_a8a70a5b", "589e89ea7a067a4c5589d50a_977cace9", "589e89ec7a067a4c5589d616_82fe5357", "589e89ed7a067a4c5589d78a_5c702c3d", "589e89f17a067a4c5589d9d5_2e2b954d", "589e89f27a067a4c5589da4a_4531e457", "589e89f27a067a4c5589dad8_637b5333", "589e89f37a067a4c5589dc1c_6e4c10f7", "589e89f57a067a4c5589dcb7_16d208cc", "589e89f57a067a4c5589de16_3c41e460", "589e89f87a067a4c5589dfd2_f4d783c3", "589e89f97a067a4c5589e02d_9769db75", "589e89f97a067a4c5589e087_ba83a836", "589e89fa7a067a4c5589e0d5_f56d6103", "589e89fa7a067a4c5589e127_6649a613", "589e89fb7a067a4c5589e1bc_0bde48ce", "589e89fd7a067a4c5589e238_656401ef", "589e89fe7a067a4c5589e30c_fcdabc96", "589e8a007a067a4c5589e340_a0f7a541", "589e8a017a067a4c5589e3cd_fbf18663", "589e8a047a067a4c5589e45a_e710414f", "589e8a067a067a4c5589e4ed_d130c7e5", "589e8a087a067a4c5589e5a0_1fdeb99c", "589e8a0c7a067a4c5589e639_9958b84a", "589e8a0e7a067a4c5589e6c3_e683b013", "589e8a127a067a4c5589e74d_999dba38", "589e8a157a067a4c5589e80c_5dd4e082", "589e8a177a067a4c5589e8a3_95320179" ], "time-of-dying" : ISODate("2017-02-09T08:12:35Z"), "time-of-death" : ISODate("2017-02-11T03:49:53Z") }
PR for the all model watcher bit https:/ /github. com/juju/ juju/pull/ 7272