#!/bin/bash

# Clean rpm locks before puppet run.
# See ticket https://bugs.launchpad.net/fuel/+bug/1339236
rm -f /var/lib/rpm/__db.*
rpm --rebuilddb

mkdir -p /var/log/rabbitmq
chown -R rabbitmq:rabbitmq /var/log/rabbitmq

puppet apply -v /etc/puppet/modules/nailgun/examples/rabbitmq-only.pp

service rabbitmq-server stop
#Just in case stopping service fails
pkill -u rabbitmq

/usr/sbin/rabbitmq-server

#!/bin/bash -xe

# Clean rpm locks before puppet run.
# See ticket https://bugs.launchpad.net/fuel/+bug/1339236
rm -f /var/lib/rpm/__db.*
rpm --rebuilddb

mkdir -p /var/log/rabbitmq
chown -R rabbitmq:rabbitmq /var/log/rabbitmq

exitcode=0
puppet apply --detailed-exitcodes -v /etc/puppet/modules/nailgun/examples/keystone-only.pp || exitcode=$?
if [ $exitcode -ge 4 ]; then
  echo Puppet apply failed with exit code: $exitcode
  exit $exitcode
fi

service rabbitmq-server stop
#Just in case stopping service fails
pkill -u rabbitmq

/usr/sbin/rabbitmq-server

Exit rabbitmq container if puppet apply fails
Exit rabbitmq container if puppet apply fails

Puppet now runs for rabbitmq container with
detailed exitcodes, allowing us to fail start
of container with start.sh. Sometimes restarting
the container will resolve rare issues where
rabbitmq service doesn't start from its init script.

Change-Id: I108cc4521fa7e193c68ede466b5829ad33464224
Closes-Bug: #1358972
