Merge "amqp1 plugin update to use environment vars for transport_url"
This commit is contained in:
commit
264ed1c33e
@ -30,6 +30,11 @@ Devstack plugin for AMQP 1.0 olso.messaging driver - This plugin supports the QP
|
|||||||
|
|
||||||
AMQP1_SERVICE=qpid-dual
|
AMQP1_SERVICE=qpid-dual
|
||||||
|
|
||||||
|
5. Optionally set the network ports used to connect to the messaging service. If dual backends are to be configured, a separate Notify port must be used::
|
||||||
|
|
||||||
|
AMQP1_DEFAULT_PORT=5672
|
||||||
|
AMQP1_NOTIFY_PORT=5671
|
||||||
|
|
||||||
5. run ``stack.sh``
|
5. run ``stack.sh``
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,15 +26,29 @@
|
|||||||
# AMQP1_SERVICE - identifies the messaging backend to use. Should be
|
# AMQP1_SERVICE - identifies the messaging backend to use. Should be
|
||||||
# one of 'qpid' for broker backend or 'qpid-dual' for hybrid router-broker.
|
# one of 'qpid' for broker backend or 'qpid-dual' for hybrid router-broker.
|
||||||
# @TODO(kgiusti) add qpid-dispatch, rabbitmq, etc
|
# @TODO(kgiusti) add qpid-dispatch, rabbitmq, etc
|
||||||
# AMQP1_HOST - the host:port used to connect to the messaging service.
|
# AMQP1_HOST - the host used to connect to the messaging service.
|
||||||
# Defaults to 127.0.0.1:5672
|
# Defaults to 127.0.0.1
|
||||||
|
# AMQP1_{DEFAULT_PORT, NOTIFY_PORT} - the port used to connect to the messaging
|
||||||
|
# service. Defaults to 5672 and 5671.
|
||||||
# AMQP1_{USERNAME,PASSWORD} - for authentication with AMQP1_HOST
|
# AMQP1_{USERNAME,PASSWORD} - for authentication with AMQP1_HOST
|
||||||
#
|
#
|
||||||
|
|
||||||
# builds transport url string
|
# builds default transport url string
|
||||||
function _get_amqp1_transport_url {
|
function _get_amqp1_default_transport_url {
|
||||||
local port=${1:-5672}
|
if [ -z "$AMQP1_USERNAME" ]; then
|
||||||
echo "amqp://$AMQP1_USERNAME:$AMQP1_PASSWORD@$AMQP1_HOST:$port/"
|
echo "amqp://$AMQP1_HOST:${AMQP1_DEFAULT_PORT}/"
|
||||||
|
else
|
||||||
|
echo "amqp://$AMQP1_USERNAME:$AMQP1_PASSWORD@$AMQP1_HOST:${AMQP1_DEFAULT_PORT}/"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# builds notify transport url string
|
||||||
|
function _get_amqp1_notify_transport_url {
|
||||||
|
if [ -z "$AMQP1_USERNAME" ]; then
|
||||||
|
echo "amqp://$AMQP1_HOST:${AMQP1_NOTIFY_PORT}/"
|
||||||
|
else
|
||||||
|
echo "amqp://$AMQP1_USERNAME:$AMQP1_PASSWORD@$AMQP1_HOST:${AMQP1_NOTIFY_PORT}/"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# install packages necessary for support of the oslo.messaging AMQP
|
# install packages necessary for support of the oslo.messaging AMQP
|
||||||
@ -88,6 +102,11 @@ function _configure_qpid {
|
|||||||
fi
|
fi
|
||||||
echo "acl-file=$qpid_acl_file" | sudo tee $qpid_conf_file
|
echo "acl-file=$qpid_acl_file" | sudo tee $qpid_conf_file
|
||||||
|
|
||||||
|
# map broker port for dual backend config
|
||||||
|
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
|
||||||
|
echo "port=${AMQP1_NOTIFY_PORT}" | sudo tee --append $qpid_conf_file
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$AMQP1_USERNAME" ]; then
|
if [ -z "$AMQP1_USERNAME" ]; then
|
||||||
# no QPID user configured, so disable authentication
|
# no QPID user configured, so disable authentication
|
||||||
# and access control
|
# and access control
|
||||||
@ -117,6 +136,7 @@ sasldb_path: /var/lib/qpidd/qpidd.sasldb
|
|||||||
mech_list: PLAIN
|
mech_list: PLAIN
|
||||||
sql_select: dummy select
|
sql_select: dummy select
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
local sasl_db
|
local sasl_db
|
||||||
sasl_db=`sudo grep sasldb_path $sasl_conf_file | cut -f 2 -d ":" | tr -d [:blank:]`
|
sasl_db=`sudo grep sasldb_path $sasl_conf_file | cut -f 2 -d ":" | tr -d [:blank:]`
|
||||||
if [ ! -e $sasl_db ]; then
|
if [ ! -e $sasl_db ]; then
|
||||||
@ -185,11 +205,10 @@ router {
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create a listener for incoming connect to the router
|
# Create a listener for incoming connect to the router
|
||||||
# assign router to amqps port
|
|
||||||
cat <<EOF | sudo tee --append $qdr_conf_file
|
cat <<EOF | sudo tee --append $qdr_conf_file
|
||||||
listener {
|
listener {
|
||||||
addr: 0.0.0.0
|
addr: 0.0.0.0
|
||||||
port: amqps
|
port: ${AMQP1_DEFAULT_PORT}
|
||||||
role: normal
|
role: normal
|
||||||
EOF
|
EOF
|
||||||
if [ -z "$AMQP1_USERNAME" ]; then
|
if [ -z "$AMQP1_USERNAME" ]; then
|
||||||
@ -369,20 +388,12 @@ function _iniset_amqp1_backend {
|
|||||||
local package=$1
|
local package=$1
|
||||||
local file=$2
|
local file=$2
|
||||||
local section=${3:-DEFAULT}
|
local section=${3:-DEFAULT}
|
||||||
local port=5672
|
|
||||||
|
|
||||||
iniset $file $section rpc_backend "amqp"
|
|
||||||
iniset $file $section qpid_hostname ${AMQP1_HOST}
|
|
||||||
if [ -n "$AMQP1_USERNAME" ]; then
|
|
||||||
iniset $file oslo_messaging_amqp username $AMQP1_USERNAME
|
|
||||||
iniset $file oslo_messaging_amqp password $AMQP1_PASSWORD
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
|
if [ "$AMQP1_SERVICE" == "qpid-dual" ]; then
|
||||||
iniset $file $section transport_url $(get_transport_url "5671")
|
iniset $file $section transport_url $(get_transport_url)
|
||||||
iniset $file oslo_messaging_notifications transport_url $(get_transport_url "5672")
|
iniset $file oslo_messaging_notifications transport_url $(_get_amqp1_notify_transport_url)
|
||||||
else
|
else
|
||||||
iniset $file $section transport_url $(get_transport_url "5672")
|
iniset $file $section transport_url $(get_transport_url)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +411,7 @@ if is_service_enabled amqp1; then
|
|||||||
_iniset_amqp1_backend $@
|
_iniset_amqp1_backend $@
|
||||||
}
|
}
|
||||||
function get_transport_url {
|
function get_transport_url {
|
||||||
_get_amqp1_transport_url $@
|
_get_amqp1_default_transport_url $@
|
||||||
}
|
}
|
||||||
export -f iniset_rpc_backend
|
export -f iniset_rpc_backend
|
||||||
export -f get_transport_url
|
export -f get_transport_url
|
||||||
@ -409,6 +420,10 @@ fi
|
|||||||
|
|
||||||
# check for amqp1 service
|
# check for amqp1 service
|
||||||
if is_service_enabled amqp1; then
|
if is_service_enabled amqp1; then
|
||||||
|
|
||||||
|
AMQP1_DEFAULT_PORT=${AMQP1_DEFAULT_PORT:=5672}
|
||||||
|
AMQP1_NOTIFY_PORT=${AMQP1_NOTIFY_PORT:=5671}
|
||||||
|
|
||||||
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
||||||
# nothing needed here
|
# nothing needed here
|
||||||
:
|
:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user