← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/services-tidy into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/services-tidy into lp:maas.

Commit message:
Generate a bin/celeryd script so that it runs in the same environment as the rest of the cluster controller.

In addition, tidy up various other development services scripts.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/maas/services-tidy/+merge/126591
-- 
https://code.launchpad.net/~allenap/maas/services-tidy/+merge/126591
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/services-tidy into lp:maas.
=== modified file 'Makefile'
--- Makefile	2012-09-24 16:07:45 +0000
+++ Makefile	2012-09-27 02:55:28 +0000
@@ -77,7 +77,8 @@
 	$(buildout) install maastesting-test
 	@touch --no-create $@
 
-bin/twistd.pserv: bin/buildout buildout.cfg versions.cfg setup.py
+bin/celeryd bin/maas-provision bin/twistd.pserv: \
+    bin/buildout buildout.cfg versions.cfg setup.py
 	$(buildout) install pserv
 	@touch --no-create $@
 
@@ -276,7 +277,7 @@
 
 services/dns/@deps: bin/py
 
-services/celeryd/@deps:
+services/celeryd/@deps: bin/celeryd
 
 services/database/@deps: bin/database
 

=== modified file 'buildout.cfg'
--- buildout.cfg	2012-09-24 13:26:07 +0000
+++ buildout.cfg	2012-09-27 02:55:28 +0000
@@ -133,12 +133,14 @@
 recipe = zc.recipe.egg
 eggs =
 entry-points =
+  celeryd=celery.bin.celeryd:main
   maas-provision=provisioningserver.__main__:main
   twistd.pserv=twisted.scripts.twistd:run
 extra-paths =
   ${common:extra-paths}
   contrib/python-tx-tftp
 scripts =
+  celeryd
   maas-provision
   twistd.pserv
 

=== modified file 'services/celeryd/run'
--- services/celeryd/run	2012-09-25 14:45:59 +0000
+++ services/celeryd/run	2012-09-27 02:55:28 +0000
@@ -4,6 +4,8 @@
 
 # Exit immediately if a command exits with a non-zero status.
 set -o errexit
+# Treat unset variables as an error when substituting.
+set -o nounset
 
 # Move to the project root.
 cd "$(dirname "$0")/../.."
@@ -12,10 +14,9 @@
 # because there are race issues when restarting.
 [ -z "${logdir:-}" ] || exec &>> "${logdir}/current"
 
-# Run celeryd.
-export PYTHONPATH=$PYTHONPATH:`pwd`/src:`pwd`/etc
-export CELERY_CONFIG_MODULE=democeleryconfig
-
 # XXX JeroenVermeulen 2012-08-23, bug=1040529: Use fghack to kludge around
 # hanging celery shutdown.
-exec fghack "$(type -p celeryd)" -l INFO --beat --queues celery
+script="$(readlink -f bin/celeryd)"
+exec fghack "${script}" \
+    --loglevel INFO --beat --queues celery \
+    --config democeleryconfig

=== modified file 'services/dns/run'
--- services/dns/run	2012-09-17 16:56:23 +0000
+++ services/dns/run	2012-09-27 02:55:28 +0000
@@ -4,6 +4,8 @@
 
 # Exit immediately if a command exits with a non-zero status.
 set -o errexit
+# Treat unset variables as an error when substituting.
+set -o nounset
 
 # Move to the project root.
 cd "$(dirname "$0")/../.."
@@ -12,25 +14,25 @@
 # because there are race issues when restarting.
 [ -z "${logdir:-}" ] || exec &>> "${logdir}/current"
 
-homedir=`pwd`/run/named
+homedir="$(pwd)/run/named"
 port=5246
 rndc_port=5247
+
 # Create DNS config.
 bin/py -m maastesting.bindfixture -- \
     --create-config-only --overwrite-config \
-    --homedir $homedir \
-    --port $port --rndc-port $rndc_port
+    --homedir "${homedir}" --port "${port}" \
+    --rndc-port "${rndc_port}"
+
 # Create MAAS' DNS config: do not overwrite an existing config file
 # as the writing of the full configuration might have happened already.
-./bin/maas set_up_dns --no-clobber
+bin/maas set_up_dns --no-clobber
+
 # Edit the fixture's named.conf to include MAAS' DNS config.
-./bin/maas get_named_conf --edit --config_path \
-    `pwd`/run/named/named.conf
+bin/maas get_named_conf --edit --config_path "${homedir}/named.conf"
+
 # Run named.
-authbind=""
-if command -v authbind >/dev/null 2>&1; then
-    authbind="authbind --deep"
-fi
-exec $authbind bin/py -m maastesting.bindfixture -- \
-    --homedir $homedir \
-    --port $port --rndc-port $rndc_port
+exec $(command -v authbind && echo --deep) \
+    bin/py -m maastesting.bindfixture -- \
+    --homedir "${homedir}" --port "${port}" \
+    --rndc-port "${rndc_port}"

=== modified file 'services/pserv/run'
--- services/pserv/run	2012-09-17 16:56:23 +0000
+++ services/pserv/run	2012-09-27 02:55:28 +0000
@@ -17,8 +17,5 @@
 # Exec the Provisioning Server.
 script="$(readlink -f bin/twistd.pserv)"
 config="$(readlink -f etc/pserv.yaml)"
-authbind=""
-if command -v authbind >/dev/null 2>&1; then
-    authbind="authbind --deep"
-fi
-exec $authbind "${script}" --nodaemon --pidfile="" maas-pserv --config-file "${config}"
+exec $(command -v authbind && echo --deep) \
+    "${script}" --nodaemon --pidfile="" maas-pserv --config-file "${config}"