unit-shard-0: 03:11:01 ERROR unit.shard/0.juju-log cluster:17: Uncaught exception while in charm code:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-shard-0/charm/./src/charm.py", line 1644, in <module>
main(MongodbOperatorCharm)
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/main.py", line 551, in main
manager.run()
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/main.py", line 530, in run
self._emit()
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/main.py", line 516, in _emit
self.framework.reemit()
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/framework.py", line 870, in reemit
self._reemit()
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/framework.py", line 950, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-shard-0/charm/lib/charms/mongodb/v1/shards_interface.py", line 703, in _on_relation_changed
if not self.pass_hook_checks(event):
File "/var/lib/juju/agents/unit-shard-0/charm/lib/charms/mongodb/v1/shards_interface.py", line 759, in pass_hook_checks
mongos_hosts = event.relation.data[event.relation.app].get(HOSTS_KEY)
File "/var/lib/juju/agents/unit-shard-0/charm/venv/ops/model.py", line 1671, in __getitem__
return self._data[key]
KeyError: None
unit-shard-0: 03:11:02 ERROR juju.worker.uniter.operation hook "cluster-relation-created" (via hook dispatching script: dispatch) failed: exit status 1
Issue
Some tests randmoly fail with this stacktrace:
Solution
While this is a bug to be fixed on ops side (see https://github.com/canonical/operator/issues/1306), this is a temporary workaround to be removed when we have a new version of ops.