rabbitmq / chef-cookbook

Development repository for Chef cookbook RabbitMQ
https://supermarket.chef.io/cookbooks/rabbitmq
Apache License 2.0
212 stars 425 forks source link

Permissions containing backslash not correctly handled #565

Closed dud225 closed 4 years ago

dud225 commented 4 years ago

Hello

when granting permissions containing a backslash, for instance:

{
  "name" => "datadog",
  "password" => secrets["datadog"],
  "tag" => "monitoring",
  "rights" => component_list.map do |component|
    { "vhost" => node["ledger-vault"]["rabbitmq"][component]["vhost"], "conf" => "^aliveness-test$", "write" => "^amq\\.default$", "read" => ".*" }
   end,
},

the shellout library escape the output again:

> Mixlib::ShellOut.new("rabbitmqctl -q list_user_permissions datadog | head -n 1").run_command.stdout
 => "/\t^aliveness-test$\t^amq\\\\.default$\t.*\n" 

which breaks the condition that tests whether the permission is already set.