Charms cached per-model are not removed when the associated model is destroyed.
Ex:
$ juju list-models --uuid
NAME MODEL UUID OWNER STATUS LAST CONNECTION
admin 8d8078f9-e924-493c-847e-714aa12dae3b admin@local available 13 minutes ago
default* c8c2820f-106f-4214-8bde-824d420af533 admin@local available 20 minutes ago
foo f304e7b9-95d8-4be1-8f78-05de3bf66482 admin@local available 30 minutes ago
$ juju destroy-model foo
On the controller, the charms still exist in the charm-get-cache
$ ls /var/lib/juju/charm-get-cache/f304e7b9-95d8-4be1-8f78-05de3bf66482
local_3a_trusty_2f_grafana-1.zip
And the charm still exists as a managed resource:
juju:PRIMARY> db.managedStoredResources.find({_id: {$regex: "^buckets/f304e7b9-95d8-4be1-8f78-05de3bf66482/charms/"}}).pretty()
{
"_id" : "buckets/f304e7b9-95d8-4be1-8f78-05de3bf66482/charms/local:trusty/grafana-1-493f9c68-4ceb-413e-86b0-c07355b91711",
"bucketuuid" : "f304e7b9-95d8-4be1-8f78-05de3bf66482",
"user" : "",
"path" : "buckets/f304e7b9-95d8-4be1-8f78-05de3bf66482/charms/local:trusty/grafana-1-493f9c68-4ceb-413e-86b0-c07355b91711",
"resourceid" : "aa8d778efa63b3fc5dc9ad0a699eab450cb725662421ca8f2bd687551308a8b2d6422cdf2f142daf72972bf921d59f66",
"txn-revno" : NumberLong(2),
"txn-queue" : [
"5730f316832c160e9e958737_6dc1a0f8"
]
}
This should be easier to fix now that charms referencing counting and clean up has been tidied up.