From fc83066295b3a0afcee38f2dd79f8be4b0bedb6b Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Fri, 14 Dec 2012 09:47:33 +0000 Subject: [PATCH] install.sh add logic detecting rabbitmq Detect rabbitmq (On Ubuntu and Fedora), and sed the config files with appropriate values if it looks like we're installing on a system with rabbitmq and not the default qpidd fixes bug 1090420 Signed-off-by: Steven Hardy Change-Id: I04a40aab00e7e13d245900aeb384d769d57c4012 --- install.sh | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index e1b8a5fe..f8331675 100755 --- a/install.sh +++ b/install.sh @@ -13,6 +13,41 @@ LOG_DIR=/var/log/heat install -d $LOG_DIR +detect_rabbit() { + PKG_CMD="rpm -q" + RABBIT_PKG="rabbitmq-server" + QPID_PKG="qpid-cpp-server" + + # Detect OS type + # Ubuntu has an lsb_release command which allows us to detect if it is Ubuntu + if lsb_release -i 2>/dev/null | grep -iq ubuntu + then + PKG_CMD="dpkg -s" + QPID_PKG="qpidd" + fi + if $PKG_CMD $RABBIT_PKG > /dev/null 2>&1 + then + if ! $PKG_CMD $QPID_PKG > /dev/null 2>&1 + then + return 0 + fi + fi + return 1 +} + +sed_if_rabbit() { + DEFAULT_RABBIT_PASSWORD="guest" + conf_path=$1 + if echo $conf_path | grep ".conf$" >/dev/null 2>&1 + then + if detect_rabbit + then + echo "rabbitmq detected, configuring $conf_path for rabbit" >&2 + sed -i "/^rpc_backend\b/ s/impl_qpid/impl_kombu/" $conf_path + sed -i "/^rpc_backend/a rabbit_password=$DEFAULT_RABBIT_PASSWORD" $conf_path + fi + fi +} install_dir() { local dir=$1 @@ -32,12 +67,12 @@ install_dir() { if [ $fn = 'heat-engine.conf' ]; then sed -i "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/" $prefix/$f fi + sed_if_rabbit $prefix/$f fi done } install_dir etc $CONF_PREFIX - ./setup.py install >/dev/null rm -rf build heat.egg-info -- 2.45.2