summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-10-30 12:21:44 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-10-30 12:21:44 +0100
commit561333bd0e1ddf71ab18295d5027d51c873a1100 (patch)
tree9473d8378a2d2cf42513c45da2fa6d8e67608a3c
parent3ab1f8d196dd61e12098b1fbfd32320f82137c91 (diff)
downloadrabbitmq-server-git-561333bd0e1ddf71ab18295d5027d51c873a1100.tar.gz
rabbitmq-plugins: Don't query rabbitmqctl if env vars are explicitly set
So if RABBITMQ_PLUGINS_DIR is explicitely set in the environment, do not run rabbitmqctl. Likewise for RABBITMQ_ENABLED_PLUGINS_FILE. This prevents rabbitmq-plugins from taking configuration from a running unrelated node, when it is started from `make run-broker`. The make command will still fail later but for the correct reason: there is already a node conflicting with the one we want to start. Without this, `make run-broker` would abort with the following error: Error: {cannot_write_enabled_plugins_file, "./sbin/../etc/rabbitmq/enabled_plugins",enoent} ... which doesn't make any sense.
-rw-r--r--scripts/rabbitmq-env12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env
index cc05015cef..0cfd540273 100644
--- a/scripts/rabbitmq-env
+++ b/scripts/rabbitmq-env
@@ -200,9 +200,11 @@ rmq_normalize_path_var RABBITMQ_PID_FILE
[ "x" = "x$RABBITMQ_PLUGINS_EXPAND_DIR" ] && RABBITMQ_PLUGINS_EXPAND_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}-plugins-expand
rmq_normalize_path_var RABBITMQ_PLUGINS_EXPAND_DIR
+[ "x" != "x$RABBITMQ_ENABLED_PLUGINS_FILE" ] && RABBITMQ_ENABLED_PLUGINS_FILE_source=environment
[ "x" = "x$RABBITMQ_ENABLED_PLUGINS_FILE" ] && RABBITMQ_ENABLED_PLUGINS_FILE=${ENABLED_PLUGINS_FILE}
rmq_normalize_path_var RABBITMQ_ENABLED_PLUGINS_FILE
+[ "x" != "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR_source=environment
[ "x" = "x$RABBITMQ_PLUGINS_DIR" ] && RABBITMQ_PLUGINS_DIR=${PLUGINS_DIR}
rmq_normalize_path_var RABBITMQ_PLUGINS_DIR
@@ -237,7 +239,9 @@ rmq_check_if_shared_with_mnesia \
## Development-specific environment.
if [ "${RABBITMQ_DEV_ENV}" ]; then
- if [ "$(basename "$0")" = 'rabbitmq-plugins' ]; then
+ if [ "$(basename "$0")" = 'rabbitmq-plugins' -a \( \
+ "$RABBITMQ_PLUGINS_DIR_source" != 'environment' -o \
+ "$RABBITMQ_ENABLED_PLUGINS_FILE_source" != 'environment' \) ]; then
# We need to query the running node for the plugins directory
# and the "enabled plugins" file.
eval $( (${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl eval \
@@ -247,10 +251,12 @@ if [ "${RABBITMQ_DEV_ENV}" ]; then
"plugins_dir=\"~s\"~n"
"enabled_plugins_file=\"~s\"~n", [P, E]).' \
2>/dev/null | head -n 2) || :)
- if [ "${plugins_dir}" ]; then
+ if [ "${plugins_dir}" -a \
+ "$RABBITMQ_PLUGINS_DIR_source" != 'environment' ]; then
RABBITMQ_PLUGINS_DIR="${plugins_dir}"
fi
- if [ "${enabled_plugins_file}" ]; then
+ if [ "${enabled_plugins_file}" -a \
+ "$RABBITMQ_ENABLED_PLUGINS_FILE_source" != 'environment' ]; then
RABBITMQ_ENABLED_PLUGINS_FILE="${enabled_plugins_file}"
fi
fi