From a3f95508f27b841918f2982a796264b045bcfb22 Mon Sep 17 00:00:00 2001 From: Liam Young <liam.young@canonical.com> Date: Mon, 26 Sep 2022 10:46:24 +0000 Subject: [PATCH] Fix race when certificates relation is ready first If the certificates relation is ready the charm can attempt to start the pebbles handlers before they are ready. This change causes the configure_charm to bail if any of the pebble handlers are not ready. configure_charm calls will be called by subsequent pebble_redy events. Change-Id: I16dc6b2e25ef31f3619303c4424f80de4d65e626 --- charms/ovn-central-k8s/src/charm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/charms/ovn-central-k8s/src/charm.py b/charms/ovn-central-k8s/src/charm.py index 66108568..2092f0d5 100755 --- a/charms/ovn-central-k8s/src/charm.py +++ b/charms/ovn-central-k8s/src/charm.py @@ -298,6 +298,11 @@ class OVNCentralOperatorCharm(sunbeam_charm.OSBaseOperatorCharm): logging.debug("Aborting charm relations not ready") return + if not all([ph.pebble_ready for ph in self.pebble_handlers]): + logging.debug( + "Aborting configuration, not all pebble handlers are ready") + return + # Render Config in all containers but init should *NOT* start # the service. for ph in self.pebble_handlers: