diff --git a/lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb b/lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb index 9d5f1e098..9e330c7de 100644 --- a/lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb +++ b/lib/puppet/provider/rabbitmq_user_permissions/rabbitmqctl.rb @@ -16,6 +16,7 @@ def self.users(name, vhost) unless @users[name] @users[name] = {} rabbitmqctl('-q', 'list_user_permissions', name).split(/\n/).each do |line| + line = self::strip_backslashes(line) if line =~ /^(\S+)\s+(\S*)\s+(\S*)\s+(\S*)$/ @users[name][$1] = {:configure => $2, :read => $4, :write => $3} @@ -102,4 +103,9 @@ def set_permissions end end + def self.strip_backslashes(string) + # See: https://github.com/rabbitmq/rabbitmq-server/blob/16418a9488e15c4d8ef3bfa9fce69190fb8ec796/docs/rabbitmqctl.1.pod#output-escaping + string.gsub(/\\\\/, '\\') + end + end