diff --git a/metadata.yaml b/metadata.yaml index a37f5cf..c19b312 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -80,6 +80,9 @@ provides: description: | Send traces to tempo. +# FIXME: We need this relationship since it is needed by CertHandler +# Once this PR is merged https://github.com/canonical/observability-libs/pull/66 +# we can remove it peers: replicas: interface: coordinator_replica diff --git a/src/charm.py b/src/charm.py index e62bce4..27d0d9d 100755 --- a/src/charm.py +++ b/src/charm.py @@ -130,7 +130,7 @@ def _on_config_changed(self, event): def _on_server_cert_changed(self, _): self._update_cert() - self._on_nginx_pebble_ready(_) + self._ensure_pebble_layer() self.publish_config(tls=self._is_cert_available) def publish_config(self, tls: bool = False): @@ -169,12 +169,16 @@ def _on_loki_relation_changed(self, _): pass def _on_nginx_pebble_ready(self, _) -> None: + self._ensure_pebble_layer() + + def _ensure_pebble_layer(self) -> None: self._nginx_container.push( self.nginx.config_path, self.nginx.config(tls=self._is_cert_available), make_dirs=True ) self._nginx_container.add_layer("nginx", self.nginx.layer, combine=True) self._nginx_container.autostart() + def _update_cert(self): if not self._nginx_container.can_connect(): return