← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:update-haproxy-relations-when-config-changes into launchpad:master

 

Guruprasad has proposed merging ~lgp171188/launchpad:update-haproxy-relations-when-config-changes into launchpad:master.

Commit message:
charm/launchpad-codehosting: Reconfigure haproxy relations on config changes

When a configuration variable used by an haproxy relation changes,
reconfigure that relation to apply the change.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/458148
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:update-haproxy-relations-when-config-changes into launchpad:master.
diff --git a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
index b8eb323..f8cd61f 100644
--- a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
+++ b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
@@ -429,6 +429,21 @@ def configure_frontend_loadbalancer():
     set_state("launchpad-codehosting.frontend-loadbalancer.configured")
 
 
+@when(
+    "config.changed.haproxy_service_options_http",
+    "config.changed.haproxy_service_options_https",
+    "config.changed.haproxy_service_options_ssh",
+    "config.changed.haproxy_fe_server_options",
+    "config.changed.haproxy_fe_server_options_ssh",
+    "config.changed.port_lb_bzr_sftp",
+    "config.changed.port_bzr_sftp_base",
+    "config.changed.port_web_status_base",
+    "config.changed.workers",
+)
+def deconfigure_frontend_loadbalancer():
+    clear_flag("launchpad-codehosting.frontend-loadbalancer.configured")
+
+
 @when("loadbalancer.available", "service.configured")
 @when_not("launchpad-codehosting.loadbalancer.configured")
 def configure_loadbalancer():
@@ -471,3 +486,12 @@ def configure_loadbalancer():
         hookenv.relation_set(rel["__relid__"], services=services_yaml)
 
     set_state("launchpad-codehosting.loadbalancer.configured")
+
+
+@when(
+    "config.changed.haproxy_service_options_internal_branch_by_id",
+    "config.changed.haproxy_server_options",
+    "config.changed.port_bzr_internal",
+)
+def deconfigure_loadbalancer():
+    clear_flag("launchpad-codehosting.loadbalancer.configured")