diff --git a/scripts/setup/configure-rabbitmq b/scripts/setup/configure-rabbitmq index ff40e59c28..e2685fa9f8 100755 --- a/scripts/setup/configure-rabbitmq +++ b/scripts/setup/configure-rabbitmq @@ -5,14 +5,15 @@ set -e set -x +RABBITMQ_FLAGS=() if [ -n "$RABBITMQ_NODE" ]; then - RABBITMQ_FLAGS="-n $RABBITMQ_NODE" + RABBITMQ_FLAGS=(-n "$RABBITMQ_NODE") fi RABBITMQ_USERNAME=$("$(dirname "$0")/../get-django-setting" RABBITMQ_USERNAME) RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD) -sudo rabbitmqctl $RABBITMQ_FLAGS delete_user "$RABBITMQ_USERNAME" || true -sudo rabbitmqctl $RABBITMQ_FLAGS delete_user zulip || true -sudo rabbitmqctl $RABBITMQ_FLAGS delete_user guest || true -sudo rabbitmqctl $RABBITMQ_FLAGS add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD" -sudo rabbitmqctl $RABBITMQ_FLAGS set_user_tags "$RABBITMQ_USERNAME" administrator -sudo rabbitmqctl $RABBITMQ_FLAGS set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*' +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user "$RABBITMQ_USERNAME" || true +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user zulip || true +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user guest || true +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD" +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" set_user_tags "$RABBITMQ_USERNAME" administrator +sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'