← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/turnip:fix-celery-nagios into turnip:master

 

Colin Watson has proposed merging ~cjwatson/turnip:fix-celery-nagios into turnip:master.

Commit message:
Fix quoting in celery Nagios check

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/392293

NrpeExternalMasterProvides.add_check just joins the argument list with spaces rather than doing appropriate shell quoting, so we need to take countermeasures against that.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:fix-celery-nagios into turnip:master.
diff --git a/charm/turnip-celery/reactive/turnip-celery.py b/charm/turnip-celery/reactive/turnip-celery.py
index f13d8f3..fd1b6f6 100644
--- a/charm/turnip-celery/reactive/turnip-celery.py
+++ b/charm/turnip-celery/reactive/turnip-celery.py
@@ -82,7 +82,10 @@ def nrpe_available():
     config = hookenv.config()
     nagios.add_check(
         ['/usr/lib/nagios/plugins/check_procs', '-c', '1:128',
-         '-C', 'celery', '-a', '-A turnip.tasks worker'],
+         # We need some double-quoting here because
+         # NrpeExternalMasterProvides.add_check just joins the argument list
+         # with spaces rather than doing appropriate shell quoting.
+         '-C', 'celery', '-a', "'-A turnip.tasks worker'"],
         name='check_celery',
         description='Git celery check',
         context=config['nagios_context'])