← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/packaging_bzr1264 into lp:~maas-maintainers/maas/packaging

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/packaging_bzr1264 into lp:~maas-maintainers/maas/packaging.

Commit message:
Releasing 0.1+bzr1264+dfsg-0ubuntu2
Opening 0.1+bzr1264+dfsg-0ubuntu3

Requested reviews:
  Andres Rodriguez (andreserl)
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/packaging_bzr1264/+merge/129911
-- 
https://code.launchpad.net/~andreserl/maas/packaging_bzr1264/+merge/129911
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/packaging_bzr1264 into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/changelog'
--- debian/changelog	2012-10-11 21:38:20 +0000
+++ debian/changelog	2012-10-16 14:36:40 +0000
@@ -1,7 +1,19 @@
-maas (0.1+bzr1264+dfsg-0ubuntu2) UNRELEASED; urgency=low
+maas (0.1+bzr1264+dfsg-0ubuntu3) UNRELEASED; urgency=low
 
   * UNRELEASED
 
+ -- Andres Rodriguez <andreserl@xxxxxxxxxx>  Tue, 16 Oct 2012 10:31:37 -0400
+
+maas (0.1+bzr1264+dfsg-0ubuntu2) quantal; urgency=low
+
+  * Fix MAAS not working after CD/preseed install (LP: #1065763)
+    - debian/extras/maas-region-celeryd: Add wrapper to run celery from
+      the upstart job.
+    - debian/extras/maas-region-controller.maas-region-celery.upstart: Create
+      rabbitmq user if it does not exists.
+  * debian/control: Remove unneeded deps on python-txtftp for some binary pkgs.
+  * debian/maas-region-controller.postinst: Minor fix referencing variable.
+
  -- Andres Rodriguez <andreserl@xxxxxxxxxx>  Thu, 11 Oct 2012 17:38:08 -0400
 
 maas (0.1+bzr1264+dfsg-0ubuntu1) quantal; urgency=low

=== modified file 'debian/control'
--- debian/control	2012-10-11 14:43:48 +0000
+++ debian/control	2012-10-16 14:36:40 +0000
@@ -175,7 +175,6 @@
          python-oauth,
          python-tempita,
          python-twisted,
-         python-txtftp,
          python-zope.interface,
          rabbitmq-server,
          rsyslog,
@@ -224,7 +223,6 @@
          python-twisted,
          python-txamqp,
          python-txlongpoll,
-         python-txtftp,
          python-zope.interface,
          ${misc:Depends},
          ${python:Depends}

=== added file 'debian/extras/maas-region-celeryd'
--- debian/extras/maas-region-celeryd	1970-01-01 00:00:00 +0000
+++ debian/extras/maas-region-celeryd	2012-10-16 14:36:40 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+import os
+from grp import getgrnam
+from pwd import getpwnam
+
+def start_celery(args):
+    uid = getpwnam(args.user).pw_uid
+    gid = getgrnam(args.group).gr_gid
+
+    env = dict(os.environ, PYTHONPATH="/usr/share/maas")
+
+    command = [
+        'celeryd',
+        '--logfile=%s' % args.logfile,
+        '--schedule=%s' % args.schedule,
+        '--loglevel=INFO',
+        '--beat',
+        '-Q celery,master',
+        ]
+
+    # Change gid first, just in case changing the uid might deprive
+    # us of the privileges required to setgid.
+    os.setgid(gid)
+    os.setuid(uid)
+
+    os.execvpe(command[0], command, env=env)
+
+def main():
+    import argparse
+    parser = argparse.ArgumentParser(
+           description='MAAS celery daemon config options')
+    parser.add_argument(
+        '--user', '-u', metavar='USER', default='maas',
+        help="System user identity that should run the cluster controller.")
+    parser.add_argument(
+        '--group', '-g', metavar='GROUP', default='maas',
+        help="System group that should run the cluster controller.")
+    parser.add_argument(
+        '--logfile', '-l', metavar='LOGFILE', default='/var/log/maas/celery-region.log',
+        help="Location of the logfile.")
+    parser.add_argument(
+        '--schedule', '-s', metavar='SCHEDULE', default='/var/lib/maas/celerybeat-region-schedule',
+        help="Location of the beat schedule file.")
+
+    args = args = parser.parse_args()
+
+    start_celery(args)
+
+if __name__ == '__main__':
+   main()

=== modified file 'debian/maas-region-controller.install'
--- debian/maas-region-controller.install	2012-10-05 04:26:58 +0000
+++ debian/maas-region-controller.install	2012-10-16 14:36:40 +0000
@@ -45,6 +45,7 @@
 
 # Install all other stuff
 debian/extras/maas usr/sbin
+debian/extras/maas-region-celeryd usr/sbin
 debian/extras/20-maas.conf etc/rsyslog.d
 debian/extras/maas_remote_syslog_compress etc/cron.d
 debian/extras/99-maas usr/share/maas/conf

=== modified file 'debian/maas-region-controller.maas-region-celery.upstart'
--- debian/maas-region-controller.maas-region-celery.upstart	2012-09-29 06:48:06 +0000
+++ debian/maas-region-controller.maas-region-celery.upstart	2012-10-16 14:36:40 +0000
@@ -5,16 +5,22 @@
 description     "MAAS"
 author "Raphael Badin <raphael.badin@xxxxxxxxxxxxx>"
 
-start on filesystem and net-device-up
+start on filesystem and net-device-up and rabbitmq-server-running
 stop on runlevel [016]
 
 respawn
 
-setuid maas
-setgid maas
-
-env PYTHONPATH="/usr/share/maas/"
-# To add options to your daemon, edit the line below:
-# NOTE: Config is picked up from PYTHONPATH.
-#       In this case is picked up from /usr/share/maas/celeryconfig.py.
-exec /usr/bin/celeryd --logfile=/var/log/maas/celery-region.log --loglevel=INFO --beat --schedule=/var/lib/maas/celerybeat-region-schedule -Q celery,master
+env workers_user="maas_workers"
+env workers_pass=""
+env workers_vhost="/maas_workers"
+
+pre-start script
+	if ! /usr/sbin/rabbitmqctl list_user_permissions $workers_user 1>/dev/null 2>&1; then
+		workers_pass=`grep "maas_workers" /etc/maas/maas_local_celeryconfig.py | cut -d':' -f3 | cut -d'@' -f1`
+		/usr/sbin/rabbitmqctl add_user "$workers_user" "$workers_pass"
+		/usr/sbin/rabbitmqctl add_vhost "$workers_vhost"
+		/usr/sbin/rabbitmqctl set_permissions -p "$workers_vhost" "$workers_user" ".*" ".*" ".*"
+	fi
+end script
+
+exec /usr/sbin/maas-region-celeryd --logfile=/var/log/maas/celery-region.log --schedule=/var/lib/maas/celerybeat-region-schedule --user=maas --group=maas

=== modified file 'debian/maas-region-controller.postinst'
--- debian/maas-region-controller.postinst	2012-10-11 18:16:28 +0000
+++ debian/maas-region-controller.postinst	2012-10-16 14:36:40 +0000
@@ -74,7 +74,7 @@
 	local workers_user="maas_workers"
 	local workers_pass="$(pwgen -s 20)"
 	local workers_vhost="/maas_workers"
-	local amqp_host=$1
+	local amqp_host="$1"
 	if [ -z "$amqp_host" ]; then
 		amqp_host="localhost"
 	fi


Follow ups