File rabbitmq-cli-3.7.27-elixir-1.13.patch of Package rabbitmqctl

diff -Ndurp rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/command_modules.ex rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/command_modules.ex
--- rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/command_modules.ex	2020-06-26 06:40:52.000000000 +0300
+++ rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/command_modules.ex	2024-04-28 00:53:49.798355667 +0300
@@ -46,7 +46,7 @@ defmodule RabbitMQ.CLI.Core.CommandModul
 
   def script_scope(opts) do
     scopes = Application.get_env(:rabbitmqctl, :scopes, [])
-    scopes[Config.get_option(:script_name, opts)] || :none
+    scopes[Rabbitmq.Atom.Coerce.to_atom(Config.get_option(:script_name, opts))] || :none
   end
 
   def load_commands_core(scope) do
diff -Ndurp rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/helpers.ex rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/helpers.ex
--- rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/helpers.ex	2020-06-26 06:40:52.000000000 +0300
+++ rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/helpers.ex	2024-04-28 00:53:49.798355667 +0300
@@ -107,6 +107,16 @@ defmodule RabbitMQ.CLI.Core.Helpers do
     )
   end
 
+  def atomize_values(map, keys) do
+    Enum.reduce(map, %{},
+                fn({k, v}, acc) ->
+                  case Enum.member?(keys, k) do
+                    false -> Map.put(acc, k, v)
+                    true  -> Map.put(acc, k, Rabbitmq.Atom.Coerce.to_atom(v))
+                  end
+                end)
+  end
+
   def apply_if_exported(mod, fun, args, default) do
     Code.ensure_loaded(mod)
     case function_exported?(mod, fun, length(args)) do
diff -Ndurp rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/parser.ex rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/parser.ex
--- rabbitmq-cli-3.7.27/lib/rabbitmq/cli/core/parser.ex	2020-06-26 06:40:52.000000000 +0300
+++ rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/core/parser.ex	2024-04-28 00:59:58.074465683 +0300
@@ -15,14 +15,14 @@
 
 defmodule RabbitMQ.CLI.Core.Parser do
   alias RabbitMQ.CLI.{CommandBehaviour, FormatterBehaviour}
-  alias RabbitMQ.CLI.Core.{CommandModules, Config}
+  alias RabbitMQ.CLI.Core.{CommandModules, Config, Helpers}
 
   # Use the same jaro distance limit as in Elixir `did_you_mean`
   @jaro_distance_limit 0.77
 
   def default_switches() do
     [
-      node: :atom,
+      node: :string,
       quiet: :boolean,
       silent: :boolean,
       dry_run: :boolean,
@@ -34,18 +34,20 @@ defmodule RabbitMQ.CLI.Core.Parser do
       formatter: :string,
       printer: :string,
       file: :string,
-      script_name: :atom,
+      script_name: :string,
       rabbitmq_home: :string,
       mnesia_dir: :string,
       plugins_dir: :string,
       enabled_plugins_file: :string,
       aliases_file: :string,
-      erlang_cookie: :atom,
+      erlang_cookie: :string,
       help: :boolean,
       print_stacktrace: :boolean
     ]
   end
 
+  @atomized_options [:node, :script_name, :erlang_cookie]
+
   def default_aliases() do
     [
       p: :vhost,
@@ -80,7 +82,7 @@ defmodule RabbitMQ.CLI.Core.Parser do
         {[_alias_command_name | cmd_arguments], cmd_options, cmd_invalid} =
           parse_alias(input, command_name, alias_module, alias_content, options)
 
-        {alias_module, command_name, cmd_arguments, cmd_options, cmd_invalid}
+        {alias_module, command_name, cmd_arguments, Helpers.atomize_values(cmd_options, @atomized_options), cmd_invalid}
 
       command_module when is_atom(command_module) ->
         {[^command_name | cmd_arguments], cmd_options, cmd_invalid} =
@@ -234,7 +236,7 @@ defmodule RabbitMQ.CLI.Core.Parser do
       )
 
     norm_options = normalize_options(options, switches) |> Map.new()
-    {args, norm_options, invalid}
+    {args, Helpers.atomize_values(norm_options, @atomized_options), invalid}
   end
 
   defp build_switches(default, command, formatter) do
diff -Ndurp rabbitmq-cli-3.7.27/lib/rabbitmq/cli/ctl/commands/decode_command.ex rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/ctl/commands/decode_command.ex
--- rabbitmq-cli-3.7.27/lib/rabbitmq/cli/ctl/commands/decode_command.ex	2020-06-26 06:40:52.000000000 +0300
+++ rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/ctl/commands/decode_command.ex	2024-04-28 00:55:51.347751578 +0300
@@ -23,11 +23,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.Deco
 
   def switches() do
     [
-      cipher: :atom,
-      hash: :atom,
+      cipher: :string,
+      hash: :string,
       iterations: :integer
     ]
   end
+  @atomized_keys [:cipher, :hash]
 
   def distribution(_), do: :none
 
diff -Ndurp rabbitmq-cli-3.7.27/lib/rabbitmq/cli/ctl/commands/encode_command.ex rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/ctl/commands/encode_command.ex
--- rabbitmq-cli-3.7.27/lib/rabbitmq/cli/ctl/commands/encode_command.ex	2020-06-26 06:40:52.000000000 +0300
+++ rabbitmq-cli-3.7.27-elixir-1.13/lib/rabbitmq/cli/ctl/commands/encode_command.ex	2024-04-28 00:53:49.798355667 +0300
@@ -21,11 +21,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.Enco
 
   def switches() do
     [
-      cipher: :atom,
-      hash: :atom,
+      cipher: :string,
+      hash: :string,
       iterations: :integer
     ]
   end
+  @atomized_keys [:cipher, :hash]
 
   def distribution(_), do: :none
 
openSUSE Build Service is sponsored by