launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30694
[Merge] ~lgp171188/launchpad:charm-launchpad-codehosting-block-on-required-config-options into launchpad:master
Guruprasad has proposed merging ~lgp171188/launchpad:charm-launchpad-codehosting-block-on-required-config-options into launchpad:master.
Commit message:
charm/launchpad-codehosting: Block on required configuration options
Also replace remove_state with clear_flag.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/455454
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:charm-launchpad-codehosting-block-on-required-config-options into launchpad:master.
diff --git a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
index 5cee23e..537cccb 100644
--- a/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
+++ b/charm/launchpad-codehosting/reactive/launchpad-codehosting.py
@@ -18,7 +18,6 @@ from charms.reactive import (
clear_flag,
endpoint_from_flag,
helpers,
- remove_state,
set_flag,
set_state,
when,
@@ -270,6 +269,8 @@ def configure_document_root(config):
"service.configured",
"config.set.domain_bzr",
"config.set.domain_bzr_internal",
+ "config.set.internal_branch_by_id_root",
+ "config.set.internal_codebrowse_root",
"apache-website.available",
)
@when_not("service.apache-website.configured")
@@ -288,6 +289,22 @@ def configure_apache_website():
set_flag("service.apache-website.configured")
+@when_not_all(
+ "config.set.domain_bzr",
+ "config.set.domain_bzr_internal",
+ "config.set.internal_branch_by_id_root",
+ "config.set.internal_codebrowse_root",
+)
+def blocked_on_missing_required_config():
+ hookenv.status_set(
+ "blocked",
+ "One or more of the required configuration options "
+ "'domain_bzr', 'domain_bzr_internal', 'internal_branch_by_id_root', "
+ "and 'internal_codebrowse_root' are unset.",
+ )
+ clear_flag("service.apache-website.configured")
+
+
@when("service.apache-website.configured")
@when_not_all("service.configured", "apache-website.available")
def apache_deconfigured():
@@ -298,7 +315,7 @@ def apache_deconfigured():
@when("service.configured")
@when_not("launchpad.db.configured")
def deconfigure():
- remove_state("service.configured")
+ clear_flag("service.configured")
@when("frontend-loadbalancer.available", "service.configured")
diff --git a/charm/launchpad-codehosting/templates/launchpad-codehosting-lazr-common.conf.j2 b/charm/launchpad-codehosting/templates/launchpad-codehosting-lazr-common.conf.j2
index 63d59bd..de8d3aa 100644
--- a/charm/launchpad-codehosting/templates/launchpad-codehosting-lazr-common.conf.j2
+++ b/charm/launchpad-codehosting/templates/launchpad-codehosting-lazr-common.conf.j2
@@ -17,8 +17,8 @@ launch: False
[codehosting]
blacklisted_hostnames: localhost,127.0.0.1
host_key_pair_path: {{ base_dir }}/keys/
-{{- opt("internal_branch_by_id_root", internal_branch_by_id_root) }}
-{{- opt("internal_codebrowse_root", internal_codebrowse_root) }}
+internal_branch_by_id_root: {{ internal_branch_by_id_root }}
+internal_codebrowse_root: {{ internal_codebrowse_root }}
mirrored_branches_root: {{ base_dir }}/data/mirrors
rewrite_script_log_file: {{ logs_dir }}/rewrite.log