Set `feature_flags_file` app env for {forget,rename}_cluster_node
This is required when we try to impersonate a node: that node needs to know about the actually enabled feature flags to act properly. [#160169569]
This commit is contained in:
parent
c26058e266
commit
e25fee769a
|
|
@ -57,6 +57,7 @@ defmodule RabbitMQ.CLI.Core.Config do
|
||||||
:mnesia_dir -> "RABBITMQ_MNESIA_DIR"
|
:mnesia_dir -> "RABBITMQ_MNESIA_DIR"
|
||||||
:plugins_dir -> "RABBITMQ_PLUGINS_DIR"
|
:plugins_dir -> "RABBITMQ_PLUGINS_DIR"
|
||||||
:plugins_expand_dir -> "RABBITMQ_PLUGINS_EXPAND_DIR"
|
:plugins_expand_dir -> "RABBITMQ_PLUGINS_EXPAND_DIR"
|
||||||
|
:feature_flags_file -> "RABBITMQ_FEATURE_FLAGS_FILE"
|
||||||
:enabled_plugins_file -> "RABBITMQ_ENABLED_PLUGINS_FILE"
|
:enabled_plugins_file -> "RABBITMQ_ENABLED_PLUGINS_FILE"
|
||||||
:node -> "RABBITMQ_NODENAME"
|
:node -> "RABBITMQ_NODENAME"
|
||||||
:aliases_file -> "RABBITMQ_CLI_ALIASES_FILE"
|
:aliases_file -> "RABBITMQ_CLI_ALIASES_FILE"
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,19 @@ defmodule RabbitMQ.CLI.Core.Helpers do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def require_feature_flags_file(opts) do
|
||||||
|
case Application.get_env(:rabbit, :feature_flags_file) do
|
||||||
|
nil ->
|
||||||
|
case Config.get_option(:feature_flags_file, opts) do
|
||||||
|
nil -> {:error, :feature_flags_file_not_found}
|
||||||
|
val -> Application.put_env(:rabbit, :feature_flags_file, to_charlist(val))
|
||||||
|
end
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def node_running?(node) do
|
def node_running?(node) do
|
||||||
:net_adm.ping(node) == :pong
|
:net_adm.ping(node) == :pong
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,13 @@ defmodule RabbitMQ.CLI.Core.Validators do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def feature_flags_file_is_set(_, opts) do
|
||||||
|
case Helpers.require_feature_flags_file(opts) do
|
||||||
|
:ok -> :ok
|
||||||
|
{:error, err} -> {:validation_failure, err}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rabbit_is_loaded(_, opts) do
|
def rabbit_is_loaded(_, opts) do
|
||||||
case Helpers.require_rabbit(opts) do
|
case Helpers.require_rabbit(opts) do
|
||||||
:ok -> :ok
|
:ok -> :ok
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForgetClusterNodeCommand do
|
||||||
[
|
[
|
||||||
&Validators.node_is_not_running/2,
|
&Validators.node_is_not_running/2,
|
||||||
&Validators.mnesia_dir_is_set/2,
|
&Validators.mnesia_dir_is_set/2,
|
||||||
|
&Validators.feature_flags_file_is_set/2,
|
||||||
&Validators.rabbit_is_loaded/2
|
&Validators.rabbit_is_loaded/2
|
||||||
],
|
],
|
||||||
[args, opts]
|
[args, opts]
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do
|
||||||
&validate_args_count_even/2,
|
&validate_args_count_even/2,
|
||||||
&Validators.node_is_not_running/2,
|
&Validators.node_is_not_running/2,
|
||||||
&Validators.mnesia_dir_is_set/2,
|
&Validators.mnesia_dir_is_set/2,
|
||||||
|
&Validators.feature_flags_file_is_set/2,
|
||||||
&Validators.rabbit_is_loaded/2
|
&Validators.rabbit_is_loaded/2
|
||||||
],
|
],
|
||||||
[args, opts]
|
[args, opts]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue