Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/rabbitmq/cli/core/ansi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,20 @@ defmodule RabbitMQ.CLI.Core.ANSI do
def bright(string) do
"#{IO.ANSI.bright()}#{string}#{IO.ANSI.reset()}"
end

def red(string) do
"#{IO.ANSI.red()}#{string}#{IO.ANSI.reset()}"
end

def yellow(string) do
"#{IO.ANSI.yellow()}#{string}#{IO.ANSI.reset()}"
end

def bright_red(string) do
"#{IO.ANSI.bright()}#{IO.ANSI.red()}#{string}#{IO.ANSI.reset()}"
end

def bright_yellow(string) do
"#{IO.ANSI.bright()}#{IO.ANSI.yellow()}#{string}#{IO.ANSI.reset()}"
end
end
18 changes: 17 additions & 1 deletion lib/rabbitmq/cli/core/distribution.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Copyright (c) 2016-2020 VMware, Inc. or its affiliates. All rights reserved.

defmodule RabbitMQ.CLI.Core.Distribution do
alias RabbitMQ.CLI.Core.{Config, Helpers}
alias RabbitMQ.CLI.Core.{ANSI, Config, Helpers}

#
# API
Expand Down Expand Up @@ -77,6 +77,7 @@ defmodule RabbitMQ.CLI.Core.Distribution do

cookie ->
Node.set_cookie(cookie)
maybe_warn_about_deprecated_rabbitmq_erlang_cookie_env_variable(options)
:ok
end
end
Expand Down Expand Up @@ -109,4 +110,19 @@ defmodule RabbitMQ.CLI.Core.Distribution do
rmq_hostname -> String.to_atom("rabbitmqcli-#{:os.getpid()}-#{rmq_hostname}")
end
end

defp maybe_warn_about_deprecated_rabbitmq_erlang_cookie_env_variable(options) do
case System.get_env("RABBITMQ_ERLANG_COOKIE") do
nil -> :ok
_ ->
case Config.output_less?(options) do
true -> :ok
false ->
warning = ANSI.bright_red("RABBITMQ_ERLANG_COOKIE env variable support is deprecated and will be REMOVED in a future version. ") <>
ANSI.yellow("Use the $HOME/.erlang.cookie file or the --erlang-cookie switch instead.")

IO.puts(warning)
end
end
end
end