When removing cos-config via juju remove-application, the charm goes into error state and is not removed.
The error is the following:
...
File "./src/charm.py", line 483, in tracing_endpoint
if self._tracing.is_ready():
AttributeError: 'COSConfigCharm' object has no attribute '_tracing'
This happens because the charm __init__ returns early on removal if the storage is detached (code):
... # in __init__
if len(self.model.storages["content-from-git"]) == 0:
# Storage isn't available yet. Since storage becomes available early enough, no need
# to observe storage-attached and complicate things; simply abort until it is ready.
return
...
Then, the call to self._tracing.is_ready() which happens here (and is called by the @trace_charm decorator) fails because self._tracing is not defined.
Solution
Move the self._tracing definition above the early constructor return.
Issue
When removing cos-config via
juju remove-application
, the charm goes into error state and is not removed.The error is the following:
This happens because the charm
__init__
returns early on removal if the storage is detached (code):Then, the call to
self._tracing.is_ready()
which happens here (and is called by the@trace_charm
decorator) fails becauseself._tracing
is not defined.Solution
Move the
self._tracing
definition above the early constructor return.Testing Instructions
charmcraft pack
(from the PR)juju deploy ./the.charm cos-config
juju remove-application --destroy-storage cos-config