← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/turnip:charms-handle-relationship-broken into turnip:master

 

Guruprasad has proposed merging ~lgp171188/turnip:charms-handle-relationship-broken into turnip:master.

Commit message:
charm/*: Handle relation departures properly

This is required for the configuration to be set up properly when a
relationship is re-joined after a departure.


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/turnip/+git/turnip/+merge/487056
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/turnip:charms-handle-relationship-broken into turnip:master.
diff --git a/charm/turnip-pack-frontend-git/reactive/turnip-pack-frontend-git.py b/charm/turnip-pack-frontend-git/reactive/turnip-pack-frontend-git.py
index adcf794..d21e046 100644
--- a/charm/turnip-pack-frontend-git/reactive/turnip-pack-frontend-git.py
+++ b/charm/turnip-pack-frontend-git/reactive/turnip-pack-frontend-git.py
@@ -36,6 +36,16 @@ def turnip_pack_virt_available():
         )
 
 
+@when_not("turnip-pack-virt.available")
+@when("turnip.services.pack-virt")
+def turnip_pack_virt_unavailable():
+    clear_flag("turnip.services.pack-virt")
+    clear_flag("turnip.configured")
+    status.blocked(
+        "turnip-pack-virt must be related to the http interface"
+    )
+
+
 @when("turnip.installed", "turnip.services.pack-virt")
 @when_not("turnip.configured")
 def configure_turnip():
diff --git a/charm/turnip-pack-frontend-http/reactive/turnip-pack-frontend-http.py b/charm/turnip-pack-frontend-http/reactive/turnip-pack-frontend-http.py
index 784f68c..87c0cfd 100644
--- a/charm/turnip-pack-frontend-http/reactive/turnip-pack-frontend-http.py
+++ b/charm/turnip-pack-frontend-http/reactive/turnip-pack-frontend-http.py
@@ -54,6 +54,16 @@ def turnip_pack_virt_available():
         )
 
 
+@when_not("turnip-pack-virt.available")
+@when("turnip.services.pack-virt")
+def turnip_pack_virt_unavailable():
+    clear_flag("turnip.services.pack-virt")
+    clear_flag("turnip.configured")
+    status.blocked(
+        "turnip-pack-virt must be related to the http interface"
+    )
+
+
 @when(
     "turnip.created_cgit_user",
     "turnip.installed",
diff --git a/charm/turnip-pack-frontend-ssh/reactive/turnip-pack-frontend-ssh.py b/charm/turnip-pack-frontend-ssh/reactive/turnip-pack-frontend-ssh.py
index 9ebe2e8..39dc40b 100644
--- a/charm/turnip-pack-frontend-ssh/reactive/turnip-pack-frontend-ssh.py
+++ b/charm/turnip-pack-frontend-ssh/reactive/turnip-pack-frontend-ssh.py
@@ -42,6 +42,16 @@ def turnip_pack_virt_available():
         )
 
 
+@when_not("turnip-pack-virt.available")
+@when("turnip.services.pack-virt")
+def turnip_pack_virt_unavailable():
+    clear_flag("turnip.services.pack-virt")
+    clear_flag("turnip.configured")
+    status.blocked(
+        "turnip-pack-virt must be related to the http interface"
+    )
+
+
 @when(
     "turnip.installed",
     "turnip.services.pack-virt",
diff --git a/charm/turnip-pack-virt/reactive/turnip-pack-virt.py b/charm/turnip-pack-virt/reactive/turnip-pack-virt.py
index abad7b4..cc1c029 100644
--- a/charm/turnip-pack-virt/reactive/turnip-pack-virt.py
+++ b/charm/turnip-pack-virt/reactive/turnip-pack-virt.py
@@ -37,6 +37,16 @@ def turnip_pack_backend_available():
         )
 
 
+@when_not("turnip-pack-backend.available")
+@when("turnip.services.pack-backend")
+def turnip_pack_backend_unavailable():
+    clear_flag("turnip.services.pack-backend")
+    clear_flag("turnip.configured")
+    status.blocked(
+        "turnip-pack-backend must be related to the http interface"
+    )
+
+
 @when("turnip.installed", "turnip.services.pack-backend")
 @when_not("turnip.configured")
 def configure_turnip():