Cleanup compiler warnings
This commit is contained in:
parent
2174446ff9
commit
6288d75472
|
|
@ -25,7 +25,7 @@ defmodule RabbitMQ.CLI.Core.CommandModules do
|
|||
end
|
||||
|
||||
def is_command?([head | _]), do: is_command?(head)
|
||||
def is_command?(str), do: module_map[str] != nil
|
||||
def is_command?(str), do: module_map()[str] != nil
|
||||
|
||||
def load(opts) do
|
||||
scope = script_scope(opts)
|
||||
|
|
|
|||
|
|
@ -32,16 +32,16 @@ defmodule RabbitMQ.CLI.Core.ExitCodes do
|
|||
def exit_tempfail, do: @exit_tempfail
|
||||
def exit_config, do: @exit_config
|
||||
|
||||
def exit_code_for({:validation_failure, :not_enough_args}), do: exit_usage
|
||||
def exit_code_for({:validation_failure, :too_many_args}), do: exit_usage
|
||||
def exit_code_for({:validation_failure, {:not_enough_args, _}}), do: exit_usage
|
||||
def exit_code_for({:validation_failure, {:too_many_args, _}}), do: exit_usage
|
||||
def exit_code_for({:validation_failure, {:bad_argument, _}}), do: exit_dataerr
|
||||
def exit_code_for({:validation_failure, :bad_argument}), do: exit_dataerr
|
||||
def exit_code_for({:validation_failure, {:bad_option, _}}), do: exit_usage
|
||||
def exit_code_for({:validation_failure, _}), do: exit_usage
|
||||
def exit_code_for({:badrpc, :timeout}), do: exit_tempfail
|
||||
def exit_code_for({:badrpc, :nodedown}), do: exit_unavailable
|
||||
def exit_code_for({:error, _}), do: exit_software
|
||||
def exit_code_for({:validation_failure, :not_enough_args}), do: exit_usage()
|
||||
def exit_code_for({:validation_failure, :too_many_args}), do: exit_usage()
|
||||
def exit_code_for({:validation_failure, {:not_enough_args, _}}), do: exit_usage()
|
||||
def exit_code_for({:validation_failure, {:too_many_args, _}}), do: exit_usage()
|
||||
def exit_code_for({:validation_failure, {:bad_argument, _}}), do: exit_dataerr()
|
||||
def exit_code_for({:validation_failure, :bad_argument}), do: exit_dataerr()
|
||||
def exit_code_for({:validation_failure, {:bad_option, _}}), do: exit_usage()
|
||||
def exit_code_for({:validation_failure, _}), do: exit_usage()
|
||||
def exit_code_for({:badrpc, :timeout}), do: exit_tempfail()
|
||||
def exit_code_for({:badrpc, :nodedown}), do: exit_unavailable()
|
||||
def exit_code_for({:error, _}), do: exit_software()
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,19 +25,19 @@ defmodule RabbitMQ.CLI.Core.Helpers do
|
|||
parse_node(RabbitMQ.CLI.Core.Config.get_option(:node))
|
||||
end
|
||||
|
||||
def parse_node(nil), do: get_rabbit_hostname
|
||||
def parse_node(nil), do: get_rabbit_hostname()
|
||||
def parse_node(name) when is_atom(name) do
|
||||
parse_node(to_string(name))
|
||||
end
|
||||
def parse_node(name) do
|
||||
case String.split(name, "@", parts: 2) do
|
||||
[_,""] -> name <> "#{hostname}" |> String.to_atom
|
||||
[_,""] -> name <> "#{hostname()}" |> String.to_atom
|
||||
[_,_] -> name |> String.to_atom
|
||||
[_] -> name <> "@#{hostname}" |> String.to_atom
|
||||
[_] -> name <> "@#{hostname()}" |> String.to_atom
|
||||
end
|
||||
end
|
||||
|
||||
def connect_to_rabbitmq, do: :net_kernel.connect_node(get_rabbit_hostname)
|
||||
def connect_to_rabbitmq, do: :net_kernel.connect_node(get_rabbit_hostname())
|
||||
def connect_to_rabbitmq(input) when is_atom(input), do: :net_kernel.connect_node(input)
|
||||
def connect_to_rabbitmq(input) when is_binary(input) do
|
||||
input
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddUserCommand do
|
|||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def validate(args, _) when length(args) < 2 do
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate([_|_] = args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
defmodule RabbitMQ.CLI.Ctl.Commands.AuthenticateUserCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags []
|
||||
|
||||
def validate(args, _) when length(args) < 2, do: {:validation_failure, :not_enough_args}
|
||||
def validate(args, _) when length(args) > 2, do: {:validation_failure, :too_many_args}
|
||||
def validate([_,_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CancelSyncQueueCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def merge_defaults([_|_] = args, opts) do
|
||||
{args, Map.merge(default_opts, opts)}
|
||||
{args, Map.merge(default_opts(), opts)}
|
||||
end
|
||||
|
||||
def usage, do: "cancel_sync_queue [-p <vhost>] queue"
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ChangePasswordCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def validate(args, _) when length(args) < 2, do: {:validation_failure, :not_enough_args}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearGlobalParameterCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, opts}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearOperatorPolicyCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearParameterCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPasswordCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate([_|_] = args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPermissionsCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPolicyCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearTopicPermissionsCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,12 +16,10 @@
|
|||
|
||||
defmodule RabbitMQ.CLI.Ctl.Commands.CloseAllConnectionsCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{global: false, vhost: "/", per_connection_delay: 0, limit: 0}, opts)}
|
||||
end
|
||||
|
||||
|
||||
def validate(args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate(args, _) when length(args) < 1, do: {:validation_failure, :not_enough_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
@ -59,7 +57,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CloseAllConnectionsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def switches(), do: [global: :boolean, per_connection_delay: :integer, limit: :integer]
|
||||
|
||||
|
||||
def usage, do: "close_all_connections [-p <vhost> --limit <limit>] [-n <node> --global] [--per-connection-delay <delay>] <explanation>"
|
||||
|
||||
def banner([explanation], %{node: node_name, global: true}) do
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.CloseConnectionCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate(args, _) when length(args) > 2, do: {:validation_failure, :too_many_args}
|
||||
def validate(args, _) when length(args) < 2, do: {:validation_failure, :not_enough_args}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.ClusterStatusCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate(args, _) when length(args) != 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteUserCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate(args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteVhostCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate([_|_] = args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.EnvironmentCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def validate([_|_], _), do: {:validation_failure, :too_many_args}
|
||||
def validate(_, _), do: :ok
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
defmodule RabbitMQ.CLI.Ctl.Commands.ForceResetCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.JoinClusterCommand do
|
|||
alias RabbitMQ.CLI.Core.Helpers, as: Helpers
|
||||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags [
|
||||
:disc, # --disc is accepted for consistency's sake.
|
||||
:ram
|
||||
]
|
||||
|
||||
def switches() do
|
||||
[
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListBindingsCommand do
|
|||
def merge_defaults([], opts) do
|
||||
{~w(source_name source_kind
|
||||
destination_name destination_kind
|
||||
routing_key arguments), Map.merge(default_opts, opts)}
|
||||
routing_key arguments), Map.merge(default_opts(), opts)}
|
||||
end
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(default_opts, opts)}
|
||||
{args, Map.merge(default_opts(), opts)}
|
||||
end
|
||||
|
||||
def usage() do
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListGlobalParametersCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags []
|
||||
|
||||
def merge_defaults([], opts) do
|
||||
{[], opts}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListOperatorPoliciesCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def scopes(), do: [:ctl, :diagnostics]
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListParametersCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags [:vhost]
|
||||
def merge_defaults([], opts) do
|
||||
{[], Map.merge(%{vhost: "/"}, opts)}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListPermissionsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListPoliciesCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def scopes(), do: [:ctl, :diagnostics]
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListQueuesCommand do
|
|||
end
|
||||
end
|
||||
def merge_defaults([_|_] = args, opts) do
|
||||
{args, Map.merge(default_opts, opts)}
|
||||
{args, Map.merge(default_opts(), opts)}
|
||||
end
|
||||
def merge_defaults([], opts) do
|
||||
merge_defaults(~w(name messages), opts)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListTopicPermissionsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserPermissionsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags []
|
||||
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate([_|_] = args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserTopicPermissionsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags []
|
||||
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
def validate([_|_] = args, _) when length(args) > 1, do: {:validation_failure, :too_many_args}
|
||||
def validate([_], _), do: :ok
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUsersCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags []
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def scopes(), do: [:ctl, :diagnostics]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListVhostsCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def formatter(), do: RabbitMQ.CLI.Formatters.Table
|
||||
@flags []
|
||||
|
||||
@info_keys ~w(name tracing)a
|
||||
|
||||
def scopes(), do: [:ctl, :diagnostics]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.PurgeQueueCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def usage, do: "purge_queue <queue>"
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ReportCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def scopes(), do: [:ctl, :diagnostics]
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
defmodule RabbitMQ.CLI.Ctl.Commands.ResetCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.RotateLogsCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetClusterNameCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetDiskFreeLimitCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def validate([], _) do
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetGlobalParameterCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, opts}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetParameterCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(opts, %{vhost: "/"})}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetPermissionsCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetTopicPermissionsCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def merge_defaults(args, opts) do
|
||||
{args, Map.merge(%{vhost: "/"}, opts)}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetUserTagsCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def validate([], _), do: {:validation_failure, :not_enough_args}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetVmMemoryHighWatermarkCommand do
|
|||
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
def validate([], _) do
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.StartAppCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.StopAppCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
def validate([_|_] = args, _) when length(args) > 0, do: {:validation_failure, :too_many_args}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SyncQueueCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def merge_defaults([_|_] = args, opts) do
|
||||
{args, Map.merge(default_opts, opts)}
|
||||
{args, Map.merge(default_opts(), opts)}
|
||||
end
|
||||
|
||||
def usage, do: "sync_queue [-p <vhost>] queue"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.TraceOffCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def validate([_|_], _), do: {:validation_failure, :too_many_args}
|
||||
def validate(_, _), do: :ok
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
defmodule RabbitMQ.CLI.Ctl.Commands.TraceOnCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
use RabbitMQ.CLI.DefaultOutput
|
||||
@flags [:vhost]
|
||||
|
||||
|
||||
def validate([_|_], _), do: {:validation_failure, :too_many_args}
|
||||
def validate(_, _), do: :ok
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
defmodule RabbitMQ.CLI.Ctl.Commands.WaitCommand do
|
||||
@behaviour RabbitMQ.CLI.CommandBehaviour
|
||||
@flags []
|
||||
|
||||
|
||||
def merge_defaults(args, opts), do: {args, opts}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ defmodule RabbitMQ.CLI.Plugins.Commands.ListCommand do
|
|||
use RabbitMQ.CLI.DefaultOutput
|
||||
|
||||
def merge_defaults([], opts), do: merge_defaults([".*"], opts)
|
||||
def merge_defaults(args, opts), do: {args, Map.merge(default_opts, opts)}
|
||||
def merge_defaults(args, opts), do: {args, Map.merge(default_opts(), opts)}
|
||||
|
||||
def switches(), do: [verbose: :boolean,
|
||||
minimal: :boolean,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ defmodule RabbitMQCtl do
|
|||
[_] -> nil
|
||||
end;
|
||||
# Skip remaining script names
|
||||
(key, val) -> val
|
||||
(_key, val) -> val
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ defmodule RabbitMQCtl do
|
|||
|> merge_defaults_longnames
|
||||
end
|
||||
|
||||
defp merge_defaults_node(%{} = opts), do: Map.merge(%{node: get_rabbit_hostname}, opts)
|
||||
defp merge_defaults_node(%{} = opts), do: Map.merge(%{node: get_rabbit_hostname()}, opts)
|
||||
|
||||
defp merge_defaults_timeout(%{} = opts), do: Map.merge(%{timeout: :infinity}, opts)
|
||||
|
||||
|
|
@ -188,11 +188,11 @@ defmodule RabbitMQCtl do
|
|||
module_name = String.to_atom("RabbitMQ.CLI.Printers." <> Macro.camelize(printer))
|
||||
case Code.ensure_loaded(module_name) do
|
||||
{:module, _} -> module_name;
|
||||
{:error, :nofile} -> default_printer
|
||||
{:error, :nofile} -> default_printer()
|
||||
end
|
||||
end
|
||||
def get_printer(_) do
|
||||
default_printer
|
||||
default_printer()
|
||||
end
|
||||
|
||||
def default_printer() do
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ test "RabbitMQ hostname is properly formed" do
|
|||
## ------------------- parse_node* tests --------------------
|
||||
|
||||
test "if nil input, retrieve standard rabbit hostname" do
|
||||
assert @subject.parse_node(nil) == get_rabbit_hostname
|
||||
assert @subject.parse_node(nil) == get_rabbit_hostname()
|
||||
end
|
||||
|
||||
test "if input is an atom short name, return the atom with hostname" do
|
||||
|
|
|
|||
Loading…
Reference in New Issue