← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/lp-codeimport:charm-conditional-rabbitmq-job into lp-codeimport:master

 

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

Commit message:
charm: Only enable datedir2amqp if RabbitMQ is configured

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Development deployments might not have RabbitMQ set up (used for error reporting), and we don't want to set up a broken cron job in that case.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-codeimport:charm-conditional-rabbitmq-job into lp-codeimport:master.
diff --git a/charm/lp-codeimport/templates/crontab.j2 b/charm/lp-codeimport/templates/crontab.j2
index b3cfdc0..51c549f 100644
--- a/charm/lp-codeimport/templates/crontab.j2
+++ b/charm/lp-codeimport/templates/crontab.j2
@@ -11,9 +11,11 @@ LP_PY={{ code_dir }}/bin/py
 
 2 1 * * *	{{ scripts_dir }}/clean_importd_logs.sh
 
+{% if rabbitmq_host and rabbitmq_user and rabbitmq_password and rabbitmq_virtual_host -%}
 # OOPS amqp
 */15 * * * *	{{ code_dir }}/bin/datedir2amqp --exchange oopses --host {{ rabbitmq_host }} --username {{ rabbitmq_user }} --password {{ rabbitmq_password }} --vhost {{ rabbitmq_virtual_host }} --repo {{ oopses_dir }} --key ""
 
+{% endif -%}
 # Work around https://bugs.launchpad.net/lp-codeimport/+bug/810288
 5 * * * *	find /tmp -ignore_readdir_race -maxdepth 1 -type f \( -name 'tmp*.pack' -o -name 'tmp*.idx' \) -mtime +3 -delete