canonical / prometheus-k8s-operator

https://charmhub.io/prometheus-k8s
Apache License 2.0
21 stars 35 forks source link

Error on application remove #388

Closed PietroPasotti closed 1 year ago

PietroPasotti commented 2 years ago

Bug Description

My guess is that attempting to config-get after some point during the teardown sequence gives permission errors. If we could postpone that self.external_url-dependent logic to some specific hook, that would probably fix this.

To Reproduce

I think it might be flaky, but repro is:

juju deploy prometheus-k8s

wait for thing to settle

juju remove-application prometheus-k8s # --> error soon after

Environment

microk8s v1.25.2 juju 3.0-beta4 controller

Relevant log output

Traceback (most recent call last):
  File "./src/charm.py", line 762, in <module>
    main(PrometheusCharm)
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/main.py", line 426, in main
    charm = charm_class(framework)
  File "./src/charm.py", line 97, in __init__
    external_url = urlparse(self.external_url)
  File "./src/charm.py", line 245, in external_url
    if web_external_url := self.model.config.get("web_external_url"):
  File "/usr/lib/python3.8/_collections_abc.py", line 660, in get
    return self[key]
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/model.py", line 547, in __getitem__
    return self._data[key]
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/model.py", line 531, in _data
    data = self._lazy_data = self._load()
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/model.py", line 1092, in _load
    return self._backend.config_get()
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/model.py", line 2289, in config_get
    out = self._run('config-get', return_output=True, use_json=True)
  File "/var/lib/juju/agents/unit-prom-1/charm/venv/ops/model.py", line 2179, in _run
    raise ModelError(e.stderr)
ops.model.ModelError: b'ERROR permission denied\n'

Additional context

No response