diff options
author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-02-20 15:08:00 +0100 |
---|---|---|
committer | Jean-Sébastien Pédron <jean-sebastien.pedron@dumbbell.fr> | 2019-02-20 15:15:46 +0100 |
commit | d5ab079fb1b880b4d8467acc0fe3514ef4fc00d5 (patch) | |
tree | 85f8ff1772253c25cb066f120f043efd1c691de6 | |
parent | 1db43731037d2922cd8733e5a6274b38966e5b17 (diff) | |
download | rabbitmq-server-git-v3.6.x.tar.gz |
rabbitmq-env: Pass remote node name ro child rabbitmqctl(8)v3.6.x
We use rabbitmqctl(8) inside `rabbitmq-env` to query the settings of the
remote nodes (path to plugins, feature flags file, the database, etc).
However, before this patch, we didn't pass the name of the remote node
as specified by the user with `-n`. Therefore, the default node name was
used (`rabbit@$hostname`) and that node may not exist at all.
This caused the executed script to run with possibly incorrect settings.
In particular, this prevented rabbitmq-plugins(8) from working properly
on a node started with `gmake run-broker`.
This should now be fixed because we extract the remote node name from
the command line arguments and pass it to the child rabbitmqctl(8).
(cherry picked from commit d32660c5fc2abc6250ff9df2393eef2d407e7351)
-rwxr-xr-x | scripts/rabbitmq-env | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/rabbitmq-env b/scripts/rabbitmq-env index 8cc3af56ae..3890a3a316 100755 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -263,7 +263,22 @@ if [ "${RABBITMQ_DEV_ENV}" ]; then "$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 \ + for arg in "$@"; do + case "$arg" in + -n) + next_is_node=1 + ;; + *) + if test "$next_is_node"; then + # If the executed script is being passed a remote node + # name, use it here to query the remote node. + node_arg="-n $arg" + break + fi + ;; + esac + done + eval $( (${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl $node_arg eval \ '{ok, P} = application:get_env(rabbit, plugins_dir), {ok, E} = application:get_env(rabbit, enabled_plugins_file), io:format( |