Skip to content

Commit b2acbae

Browse files
committed
Rename command to check_for_quorum_queues_without_an_elected_leader
and use across_all_vhosts option for global checks
1 parent df82f12 commit b2acbae

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/leader_health_check_command.ex renamed to deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/check_for_quorum_queues_without_an_elected_leader_command.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
##
55
## Copyright (c) 2007-2025 VMware, Inc. or its affiliates. All rights reserved.
66

7-
defmodule RabbitMQ.CLI.Diagnostics.Commands.LeaderHealthCheckCommand do
7+
defmodule RabbitMQ.CLI.Diagnostics.Commands.CheckForQuorumQueuesWithoutAnElectedLeaderCommand do
88
alias RabbitMQ.CLI.Core.DocGuide
99

1010
@behaviour RabbitMQ.CLI.CommandBehaviour
1111

1212
import RabbitMQ.CLI.Core.Platform, only: [line_separator: 0]
1313

14-
def switches(), do: [global: :boolean]
14+
def switches(), do: [across_all_vhosts: :boolean]
1515

1616
def scopes(), do: [:diagnostics]
1717

1818
def merge_defaults(args, opts) do
19-
{args, Map.merge(%{global: false, vhost: "/"}, opts)}
19+
{args, Map.merge(%{across_all_vhosts: false, vhost: "/"}, opts)}
2020
end
2121

2222
use RabbitMQ.CLI.Core.AcceptsOnePositionalArgument
2323
use RabbitMQ.CLI.Core.RequiresRabbitAppRunning
2424

25-
def run([pattern] = _args, %{node: node_name, vhost: vhost, global: global_opt}) do
26-
vhost = if global_opt, do: :global, else: vhost
25+
def run([pattern] = _args, %{node: node_name, vhost: vhost, across_all_vhosts: across_all_vhosts_opt}) do
26+
vhost = if across_all_vhosts_opt, do: :across_all_vhosts, else: vhost
2727

2828
case :rabbit_misc.rpc_call(node_name, :rabbit_quorum_queue, :leader_health_check, [pattern, vhost]) do
2929
[] ->
@@ -73,13 +73,13 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.LeaderHealthCheckCommand do
7373
def formatter(), do: RabbitMQ.CLI.Formatters.PrettyTable
7474

7575
def usage() do
76-
"leader_health_check [--vhost <vhost>] [--global] <pattern>"
76+
"leader_health_check [--vhost <vhost>] [--across-all-vhosts] <pattern>"
7777
end
7878

7979
def usage_additional do
8080
[
8181
["<pattern>", "regular expression pattern used to match quorum queues"],
82-
["--global", "run leader health check for all queues in all virtual hosts on the node"]
82+
["--across-all-vhosts", "run leader health check for all queues in all virtual hosts on the node"]
8383
]
8484
end
8585

@@ -93,11 +93,11 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.LeaderHealthCheckCommand do
9393

9494
def description(), do: "Checks availability and health status of quorum queue leaders"
9595

96-
def banner([name], %{global: true}),
97-
do: "Checking availability and health status of leaders for quorum queues matching #{name} in all vhosts ..."
96+
def banner([name], %{across_all_vhosts: true}),
97+
do: "Checking availability and health status of leaders for quorum queues matching '#{name}' in all vhosts ..."
9898

9999
def banner([name], %{vhost: vhost}),
100-
do: "Checking availability and health status of leaders for quorum queues matching #{name} in vhost #{vhost} ..."
100+
do: "Checking availability and health status of leaders for quorum queues matching '#{name}' in vhost #{vhost} ..."
101101

102102
def queue_lines(qs) do
103103
for q <- qs, do: "Leader for #{q["readable_name"]} is unhealthy and unavailable"

deps/rabbitmq_cli/test/diagnostics/leader_health_check_test.exs renamed to deps/rabbitmq_cli/test/diagnostics/check_for_quorum_queues_without_an_elected_leader_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
##
55
## Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

7-
defmodule LeaderHealthCheckCommandTest do
7+
defmodule CheckForQuorumQueuesWithoutAnElectedLeaderTest do
88
use ExUnit.Case, async: false
99
import TestHelper
1010

11-
@command RabbitMQ.CLI.Diagnostics.Commands.LeaderHealthCheckCommand
11+
@command RabbitMQ.CLI.Diagnostics.Commands.CheckForQuorumQueuesWithoutAnElectedLeaderCommand
1212

1313
setup_all do
1414
RabbitMQ.CLI.Core.Distribution.start()
@@ -46,7 +46,7 @@ defmodule LeaderHealthCheckCommandTest do
4646
{:error, {:badrpc, :nodedown}},
4747
@command.run(
4848
["quorum.queue.*"],
49-
%{node: :jake@thedog, vhost: "/", global: false, timeout: 200}
49+
%{node: :jake@thedog, vhost: "/", across_all_vhosts: false, timeout: 200}
5050
)
5151
)
5252
end

0 commit comments

Comments
 (0)