← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/lp-codeimport:charm-active into lp-codeimport:master

 

Colin Watson has proposed merging ~cjwatson/lp-codeimport:charm-active into lp-codeimport:master.

Commit message:
charm: Add an "active" option

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-codeimport/+git/lp-codeimport/+merge/439744

This allows us to run an initial deployment of some workers without enabling them, then enable them once we've made sure they're ready (e.g. by attaching a Ceph volume to their related `lp-codeimport-storage` unit).
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-codeimport:charm-active into lp-codeimport:master.
diff --git a/charm/lp-codeimport/config.yaml b/charm/lp-codeimport/config.yaml
index 37f990c..9b38fb9 100644
--- a/charm/lp-codeimport/config.yaml
+++ b/charm/lp-codeimport/config.yaml
@@ -1,4 +1,8 @@
 options:
+  active:
+    type: boolean
+    default: true
+    description: If true, enable import jobs.
   git_hostname:
     type: string
     default: git.launchpad.test
diff --git a/charm/lp-codeimport/templates/crontab.j2 b/charm/lp-codeimport/templates/crontab.j2
index b3cfdc0..db0fe89 100644
--- a/charm/lp-codeimport/templates/crontab.j2
+++ b/charm/lp-codeimport/templates/crontab.j2
@@ -6,9 +6,11 @@ LP_PY={{ code_dir }}/bin/py
 
 0 0 * * 1,4	/usr/sbin/logrotate -s ~/.logrotate.state {{ etc_dir }}/logrotate.conf
 
+{% if active -%}
 * * * * *	sleep {{ dispatch_offset }} && [ -f {{ base_dir }}/maintenance.txt ] || {{ code_dir }}/cronscripts/code-import-dispatcher.py -v --max-jobs=10 --log-file {{ logs_dir }}/code-import-dispatcher.log >> {{ logs_dir }}/code-import-dispatcher-out.log 2>&1
 * * * * *	sleep {{ dispatch_offset + 30 }} && [ -f {{ base_dir }}/maintenance.txt ] || {{ code_dir }}/cronscripts/code-import-dispatcher.py -v --max-jobs=10 --log-file {{ logs_dir }}/code-import-dispatcher.log >> {{ logs_dir }}/code-import-dispatcher-out.log 2>&1
 
+{% endif -%}
 2 1 * * *	{{ scripts_dir }}/clean_importd_logs.sh
 
 # OOPS amqp