← Back to team overview

wordpress-charmers team mailing list archive

[Merge] ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master

 

Thomas Cuthbert has proposed merging ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master.

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/385729
-- 
Your team Wordpress Charmers is requested to review the proposed merge of ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master.
diff --git a/dispatch b/dispatch
new file mode 120000
index 0000000..ac5c45c
--- /dev/null
+++ b/dispatch
@@ -0,0 +1 @@
+src/charm.py
\ No newline at end of file
diff --git a/src/charm.py b/src/charm.py
index 890fead..9ae7320 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -138,12 +138,12 @@ class WordpressK8sCharm(CharmBase):
         pod_alive = self.model.unit.is_leader() and self.is_service_up()
         if pod_alive:
             wordpress_configured = self.wordpress.wordpress_configured(self.get_service_ip())
-            wordpress_needs_configuring = not self.state.initialised and not wordpress_configured
-        else:
+            wordpress_needs_configuring = self.state.initialised and not wordpress_configured
+        elif self.model.unit.is_leader():
             msg = "Wordpress workload pod is not ready"
             logger.info(msg)
             self.model.unit.status = WaitingStatus(msg)
-            return
+            return event.defer()
 
         if wordpress_needs_configuring:
             msg = "Wordpress needs configuration"

Follow ups