Skip to content

Commit 4bb21d7

Browse files
RMQ-1263 CLI tools: replace Erlang files with Elixir
otherwise we end up with two copies of the compiled module on the code path some of the time. We don't need to mix Erlang and Elixir even more to bring in one constant that hasn't changed since its introduction some eight years ago. (cherry picked from commit c32b948258f226a86be91cab80448d7a536afd7d)
1 parent d2f66ce commit 4bb21d7

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## This Source Code Form is subject to the terms of the Mozilla Public
2+
## License, v. 2.0. If a copy of the MPL was not distributed with this
3+
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
##
5+
## Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
6+
7+
defmodule RabbitMQ.CLI.Core.Users do
8+
# Defined here to not drag in rabbit.hrl and Erlang compilation in an Elixir
9+
# sub-project
10+
@internal_user "rmq-internal"
11+
@cli_user "cli-user"
12+
13+
def internal_user do
14+
@internal_user
15+
end
16+
17+
def cli_user do
18+
@cli_user
19+
end
20+
end

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

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

77
defmodule RabbitMQ.CLI.Ctl.Commands.DeleteQueueCommand do
8-
alias RabbitMQ.CLI.Core.DocGuide
8+
alias RabbitMQ.CLI.Core.{DocGuide, Users}
99

1010
@behaviour RabbitMQ.CLI.CommandBehaviour
1111

@@ -51,7 +51,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteQueueCommand do
5151
}) do
5252
## Generate queue resource name from queue name and vhost
5353
queue_resource = :rabbit_misc.r(vhost, :queue, qname)
54-
user = if force, do: RabbitMQ.CLI.Common.internal_user, else: "cli_user"
54+
user = if force, do: Users.internal_user, else: Users.cli_user
5555
## Lookup a queue on broker node using resource name
5656
case :rabbit_misc.rpc_call(node, :rabbit_amqqueue, :lookup, [queue_resource]) do
5757
{:ok, queue} ->

deps/rabbitmq_cli/src/Elixir.RabbitMQ.CLI.Common.erl

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)