unit-graf-0: 22:45:28.955 ERROR unit.graf/0.juju-log grafana-source:81: Uncaught exception while in charm code:
Traceback (most recent call last):
File "./src/charm.py", line 1280, in <module>
main(GrafanaCharm, use_juju_for_storage=True)
File "/var/lib/juju/agents/unit-graf-0/charm/venv/ops/main.py", line 441, in main
_emit_charm_event(charm, dispatcher.event_name)
File "/var/lib/juju/agents/unit-graf-0/charm/venv/ops/main.py", line 149, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-graf-0/charm/venv/ops/framework.py", line 344, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-graf-0/charm/venv/ops/framework.py", line 833, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-graf-0/charm/venv/ops/framework.py", line 922, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-graf-0/charm/lib/charms/grafana_k8s/v0/grafana_source.py", line 615, in _on_grafana_source_relation_departed
removed_source = self._remove_source_from_datastore(event)
File "/var/lib/juju/agents/unit-graf-0/charm/lib/charms/grafana_k8s/v0/grafana_source.py", line 630, in _remove_source_from_datastore
stored_sources = self.get_peer_data("sources")
File "/var/lib/juju/agents/unit-graf-0/charm/lib/charms/grafana_k8s/v0/grafana_source.py", line 733, in get_peer_data
data = self._charm.peers.data[self._charm.app].get(key, "") # type: ignore[attr-defined]
AttributeError: 'NoneType' object has no attribute 'data'
unit-graf-0: 22:45:29.204 ERROR juju.worker.uniter.operation hook "grafana-source-relation-departed" (via hook dispatching script: dispatch) failed: exit status 1
This is still an issue on Juju 3.2.0.
Repro:
1. Relate prometheus to grafana
2. Remove grafana
unit-graf-0: 22:45:28.955 ERROR unit.graf/ 0.juju- log grafana-source:81: Uncaught exception while in charm code: GrafanaCharm, use_juju_ for_storage= True) juju/agents/ unit-graf- 0/charm/ venv/ops/ main.py" , line 441, in main charm_event( charm, dispatcher. event_name) juju/agents/ unit-graf- 0/charm/ venv/ops/ main.py" , line 149, in _emit_charm_event to_emit. emit(*args, **kwargs) juju/agents/ unit-graf- 0/charm/ venv/ops/ framework. py", line 344, in emit _emit(event) juju/agents/ unit-graf- 0/charm/ venv/ops/ framework. py", line 833, in _emit _reemit( event_path) juju/agents/ unit-graf- 0/charm/ venv/ops/ framework. py", line 922, in _reemit handler( event) juju/agents/ unit-graf- 0/charm/ lib/charms/ grafana_ k8s/v0/ grafana_ source. py", line 615, in _on_grafana_ source_ relation_ departed source_ from_datastore( event) juju/agents/ unit-graf- 0/charm/ lib/charms/ grafana_ k8s/v0/ grafana_ source. py", line 630, in _remove_ source_ from_datastore peer_data( "sources" ) juju/agents/ unit-graf- 0/charm/ lib/charms/ grafana_ k8s/v0/ grafana_ source. py", line 733, in get_peer_data peers.data[ self._charm. app].get( key, "") # type: ignore[ attr-defined] uniter. operation hook "grafana- source- relation- departed" (via hook dispatching script: dispatch) failed: exit status 1
Traceback (most recent call last):
File "./src/charm.py", line 1280, in <module>
main(
File "/var/lib/
_emit_
File "/var/lib/
event_
File "/var/lib/
framework.
File "/var/lib/
self.
File "/var/lib/
custom_
File "/var/lib/
removed_source = self._remove_
File "/var/lib/
stored_sources = self.get_
File "/var/lib/
data = self._charm.
AttributeError: 'NoneType' object has no attribute 'data'
unit-graf-0: 22:45:29.204 ERROR juju.worker.