Skip to content

Commit 5caad16

Browse files
Make 'ctl node_health_check' a no-op
It's been deprecated over three years ago [1] (before RabbitMQ 3.9). 1. e01753e
1 parent c0d5153 commit 5caad16

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/node_health_check_command.ex

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,18 @@ defmodule RabbitMQ.CLI.Ctl.Commands.NodeHealthCheckCommand do
99

1010
@behaviour RabbitMQ.CLI.CommandBehaviour
1111

12-
@default_timeout 70_000
13-
1412
def scopes(), do: [:ctl, :diagnostics]
1513
use RabbitMQ.CLI.Core.AcceptsDefaultSwitchesAndTimeout
1614

1715
def merge_defaults(args, opts) do
18-
timeout =
19-
case opts[:timeout] do
20-
nil -> @default_timeout
21-
:infinity -> @default_timeout
22-
other -> other
23-
end
24-
25-
{args, Map.merge(opts, %{timeout: timeout})}
16+
{args, opts}
2617
end
2718

2819
use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
2920
use RabbitMQ.CLI.Core.RequiresRabbitAppRunning
3021

31-
def run([], %{node: node_name, timeout: timeout}) do
32-
case :rabbit_misc.rpc_call(node_name, :rabbit_health_check, :node, [node_name, timeout]) do
33-
:ok ->
34-
:ok
35-
36-
true ->
37-
:ok
38-
39-
{:badrpc, _} = err ->
40-
err
41-
42-
{:error_string, error_message} ->
43-
{:healthcheck_failed, error_message}
44-
45-
{:node_is_ko, error_message, _exit_code} ->
46-
{:healthcheck_failed, error_message}
47-
48-
other ->
49-
other
50-
end
51-
end
52-
53-
def output(:ok, _) do
54-
{:ok, "Health check passed"}
55-
end
56-
57-
def output({:healthcheck_failed, message}, _) do
58-
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_software(),
59-
"Error: health check failed. Message: #{message}"}
22+
def run([], _opts) do
23+
:ok
6024
end
6125

6226
use RabbitMQ.CLI.DefaultOutput
@@ -72,17 +36,14 @@ defmodule RabbitMQ.CLI.Ctl.Commands.NodeHealthCheckCommand do
7236
def help_section(), do: :deprecated
7337

7438
def description() do
75-
"DEPRECATED. Performs intrusive, opinionated health checks on a fully booted node. " <>
76-
"See https://www.rabbitmq.com/monitoring.html#health-checks instead"
39+
"DEPRECATED. This command is a no-op. " <>
40+
"See https://www.rabbitmq.com/monitoring.html#health-checks"
7741
end
7842

79-
def banner(_, %{node: node_name, timeout: timeout}) do
43+
def banner(_, _opts) do
8044
[
81-
"This command is DEPRECATED and will be removed in a future version.",
82-
"It performs intrusive, opinionated health checks and requires a fully booted node.",
83-
"Use one of the options covered in https://www.rabbitmq.com/monitoring.html#health-checks instead.",
84-
"Timeout: #{trunc(timeout / 1000)} seconds ...",
85-
"Checking health of node #{node_name} ..."
45+
"This command is DEPRECATED and is a no-op. It will be removed in a future version. ",
46+
"Use one of the options covered in https://www.rabbitmq.com/monitoring.html#health-checks instead."
8647
]
8748
end
8849
end

0 commit comments

Comments
 (0)