prometheus-k8s-operator
prometheus-k8s-operator copied to clipboard
cannot stop service: promtail service does not exist
Bug Description
upon destroying an application using the logging integration, I hit an error. Probably occurs because the teardown took some time and got stuck because of a failure in another library. What I'm guessing is, the hook logging-relation-departed ran once, promtail was stopped and the service removed, and then the hook errored out. Then the hook ran again, and promtail had already been killed so it's now not found instead.
To Reproduce
juju deploy cos-lite --trust juju remove-application traefik
Environment
juju info v0.1
┌──────────────┬────────────────────────────────┐
│ jhack │ 0.3.32 │
│ python │ 3.10.12 (/bin/python3) │
│ juju-* snaps │ │
│ microk8s │ MicroK8s v1.29.2 revision 6591 │
│ lxd │ 5.20 │
│ multipass │ 1.13.1 │
│ multipassd │ 1.13.1 │
│ os │ Ubuntu 22.04.4 LTS │
│ kernel │ Linux 6.5.0-21-generic x86_64 │
└──────────────┴────────────────────────────────┘
Relevant log output
unit-traefik-0: 13:38:46 ERROR unit.traefik/0.juju-log logging:29: Uncaught exception while in charm code:
Traceback (most recent call last):
File "./src/charm.py", line 1034, in <module>
main(TraefikIngressCharm, use_juju_for_storage=True)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/main.py", line 456, in main
_emit_charm_event(charm, dispatcher.event_name)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/main.py", line 144, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/framework.py", line 351, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/framework.py", line 853, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/framework.py", line 943, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-traefik-0/charm/lib/charms/loki_k8s/v0/loki_push_api.py", line 1889, in _on_relation_departed
self._container.stop(WORKLOAD_SERVICE_NAME)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/model.py", line 2161, in stop
self._pebble.stop_services(service_names)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/pebble.py", line 1923, in stop_services
return self._services_action('stop', services, timeout, delay)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/pebble.py", line 1960, in _services_action
resp = self._request('POST', '/v1/services', body=body)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/pebble.py", line 1754, in _request
response = self._request_raw(method, path, query, headers, data)
File "/var/lib/juju/agents/unit-traefik-0/charm/venv/ops/pebble.py", line 1800, in _request_raw
raise APIError(body, code, status, message) from None
ops.pebble.APIError: cannot stop services: service "promtail" does not exist
Additional context
No response