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@rabbitmq.com> | 2019-02-20 15:08:00 +0100 |
| commit | d32660c5fc2abc6250ff9df2393eef2d407e7351 (patch) | |
| tree | 89f07bb5b579440a6a4163683c93f66e20d66586 | |
| parent | 8f7b78c8b19624d83cc8b8edf287cbb11f83a413 (diff) | |
| download | rabbitmq-server-git-d32660c5fc2abc6250ff9df2393eef2d407e7351.tar.gz | |
rabbitmq-env: Pass remote node name ro child rabbitmqctl(8)
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).
| -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 2b06dec2cd..a70e902b78 100755 --- a/scripts/rabbitmq-env +++ b/scripts/rabbitmq-env @@ -330,7 +330,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, F} = application:get_env(rabbit, feature_flags_file), {ok, P} = application:get_env(rabbit, plugins_dir), {ok, E} = application:get_env(rabbit, enabled_plugins_file), |
