puppet-openstack-integration/install_modules.sh
Emilien Macchi 9da87065f5 Install RabbitMQ 3.5.4 on Ubuntu systems
RabbitMQ 3.5.5 has a bug [1] that prevent puppetlabs-rabbitmq module to
create permissions:

Could not evaluate: cannot parse line from
list_user_permissions:/usr/sbin/rabbitmqctl: 19: [: Linux: unexpected
operator]

This patch is a workaround to make sure we install the previous stable
version of RabbitMQ (3.5.4). Since puppetlabs-rabbitmq module will only
check if the package is 'installed', it won't try to update it.

[1] https://github.com/rabbitmq/rabbitmq-server/issues/321

Change-Id: I8e0fa8e62e93b62317011fd7c8a2730cd293d4c7
2015-09-24 13:37:12 -04:00

74 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -ex
if [ ! -z ${GEM_HOME} ]; then
GEM_BIN_DIR=${GEM_HOME}/bin/
fi
export SCRIPT_DIR=$(readlink -f "$(dirname $0)")
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-/etc/puppet/modules}
install_external() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 ${GEM_BIN_DIR}r10k puppetfile install -v
}
install_openstack() {
cat > clonemap.yaml <<EOF
clonemap:
- name: '(.*?)/puppet-(.*)'
dest: '$PUPPETFILE_DIR/\2'
EOF
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
${SCRIPT_DIR}/Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
)
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml \
--cache-dir /opt/git \
--zuul-ref $ZUUL_REF \
--zuul-branch $ZUUL_BRANCH \
--zuul-url $ZUUL_URL \
git://git.openstack.org $project_names
}
install_all() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile ${GEM_BIN_DIR}r10k puppetfile install -v
}
gem install r10k --no-ri --no-rdoc
# make sure there is no puppet module pre-installed
rm -rf "${PUPPETFILE_DIR:?}/"*
# If zuul-cloner is there, have it install modules using zuul refs
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \
--prefix ${SCRIPT_DIR}/Puppetfile \
--suffix '%d'
install_external
install_openstack
else
install_all
fi
puppet module list
if type "apt-get" 2>/dev/null; then
# apt-get update needs to be run to be able (later) to install
# ubuntu-cloud-keyring package with puppet
/usr/bin/apt-get update
# install rabbitmq-server from ubuntu repository until
# rabbitmq repository contains the fix mentionned in:
# https://github.com/rabbitmq/rabbitmq-server/issues/321
/usr/bin/apt-get install -y rabbitmq-server
else
# disable SElinux
# something is python-cffi is preventing Nova & Keystone to
# correctly run when SElinux is enforced. See bug:
# https://bugzilla.redhat.com/show_bug.cgi?id=1249685
# We use || true because if selinux is Disabled the following
# command would fail
/usr/sbin/setenforce 0 || true
fi