Handle root vHost declaration
If the source chart does not declare a vHost value, or uses the value of "/", the script would fail upon trying to declare the vhost. This change avoids the declaration of the "/" vhost, and continues with setting the specified user with permissions to "/" Change-Id: I28619c0aef22049c632c92a2f9a9d3831f8c284c
This commit is contained in:
parent
00b40480a3
commit
34b2a965cb
@ -45,6 +45,8 @@ RABBITMQ_PASSWORD=$(echo "${RABBITMQ_USER_CONNECTION}" | \
|
||||
RABBITMQ_VHOST=$(echo "${RABBITMQ_USER_CONNECTION}" | \
|
||||
awk -F'[@]' '{print $2}' | \
|
||||
awk -F'[:/]' '{print $3}')
|
||||
# Resolve vHost to / if no value is set
|
||||
RABBITMQ_VHOST="${RABBITMQ_VHOST:-/}"
|
||||
|
||||
function rabbitmqadmin_cli () {
|
||||
rabbitmqadmin \
|
||||
@ -62,10 +64,15 @@ rabbitmqadmin_cli \
|
||||
password="${RABBITMQ_PASSWORD}" \
|
||||
tags="user"
|
||||
|
||||
if [ "${RABBITMQ_VHOST}" != "/" ]
|
||||
then
|
||||
echo "Managing: vHost: ${RABBITMQ_VHOST}"
|
||||
rabbitmqadmin_cli \
|
||||
declare vhost \
|
||||
name="${RABBITMQ_VHOST}"
|
||||
else
|
||||
echo "Skipping root vHost declaration: vHost: ${RABBITMQ_VHOST}"
|
||||
fi
|
||||
|
||||
echo "Managing: Permissions: ${RABBITMQ_USERNAME} on ${RABBITMQ_VHOST}"
|
||||
rabbitmqadmin_cli \
|
||||
|
Loading…
Reference in New Issue
Block a user