juju 2.7.6
using ceph-client interface within the charm-prometheus-ceph-exporter, I'm seeing hook errors on ceph-client-relation-departed.
This line to call self.key() triggers relation-get, but the uniter gets permission denied as the relation is already gone and not queryable at the time of the hooks running.
https://opendev.org/openstack/charm-interface-ceph-client/src/branch/master/requires.py#L43
Perhaps 'departed' handler should be the same as the 'broken' hook, rather than the changed hook to clean up these errors:
unit-prometheus-ceph-exporter-0: 09:41:37 DEBUG unit.prometheus-ceph-exporter/0.juju-log ceph:4: tracer>
tracer: hooks phase, 1 handlers queued
tracer: ++ queue handler hooks/relations/ceph-client/requires.py:40:changed
unit-prometheus-ceph-exporter-0: 09:41:37 INFO unit.prometheus-ceph-exporter/0.juju-log ceph:4: Invoking reactive handler: hooks/relations/ceph-client/requires.py:40:changed
unit-prometheus-ceph-exporter-0: 09:41:37 DEBUG unit.prometheus-ceph-exporter/0.ceph-relation-departed ERROR permission denied
unit-prometheus-ceph-exporter-0: 09:41:37 ERROR unit.prometheus-ceph-exporter/0.juju-log ceph:4: Hook error:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 379, in dispatch
_invoke(hook_handlers)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/charm/hooks/relations/ceph-client/requires.py", line 43, in changed
'key': self.key(),
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/relations.py", line 248, in __accessor
return self.get_remote(field)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/relations.py", line 508, in get_remote
return self.conversation(scope).get_remote(key, default)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charms/reactive/relations.py", line 797, in get_remote
value = hookenv.relation_get(key, unit, relation_id)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charmhelpers/core/hookenv.py", line 93, in wrapper
res = func(*args, **kwargs)
File "/var/lib/juju/agents/unit-prometheus-ceph-exporter-0/.venv/lib/python3.8/site-packages/charmhelpers/core/hookenv.py", line 470, in relation_get
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-r', 'ceph:4', 'key', 'ceph-mon/0']' returned non-zero exit status 1.