~julian-edwards/maas/packaging-1.6.0-fix

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# maas - txlongpoll service
#
# MAAS Provisioning Service txlongpoll

description     "MAAS txlongpoll"
author "Andres Rodriguez <andres.rodriguez@canonical.com>"

start on filesystem and net-device-up and rabbitmq-server-running
stop on runlevel [016]

respawn

env longpoll_user="maas_longpoll"
env longpoll_pass=""
env longpoll_vhost="/maas_longpoll"

pre-start script
	if [ -f /usr/sbin/rabbitmqctl ] && ! /usr/sbin/rabbitmqctl list_user_permissions "$longpoll_user" 1>/dev/null 2>&1; then
		longpoll_pass=`/bin/grep "password" /etc/maas/txlongpoll.yaml | cut -d'"' -f2`
		/usr/sbin/rabbitmqctl add_user "$longpoll_user" "$longpoll_pass"
		/usr/sbin/rabbitmqctl add_vhost "$longpoll_vhost"
		/usr/sbin/rabbitmqctl set_permissions -p "$longpoll_vhost" "$longpoll_user" ".*" ".*" ".*"
	fi
end script

# To add options to your daemon, edit the line below:
exec /usr/bin/twistd -n --uid=maas --gid=maas --pidfile=/run/maas-txlongpoll.pid --logfile=/dev/null txlongpoll --config-file=/etc/maas/txlongpoll.yaml