voxpupuli/puppet-rabbitmq

Setting 'RABBITMQ_USE_LONGNAME' to true causes failures during user add

bsg-sfrazer opened this issue · 2 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.12
  • Ruby: 2.0.0p648
  • Distribution: CentOS 7.6.1810
  • Module version: 9.1.0

How to reproduce (e.g Puppet code you use)

  class { 'rabbitmq':
    ssl                      => true,
    ssl_port                 => 5671,
    ssl_cacert               => '/etc/ssl/certs/ca-bundle.crt',
    ssl_cert                 => "/etc/ssl/_.${::location}.crt",
    ssl_key                  => "/etc/ssl/_.${::location}.key",
    ssl_verify               => 'verify_peer',
    ssl_fail_if_no_peer_cert => false,
    management_ssl           => false,
    environment_variables => {
      'RABBITMQ_USE_LONGNAME' => 'true',
    }

...

{
  rabbitmq_user { 'dev':
    password => $rabbitmq_user_password,
    provider => 'rabbitmqctl',
    tags     => 'monitoring',
  }

  rabbitmq_vhost { 'dev':
    ensure   => present,
    provider => 'rabbitmqctl',
  }
  rabbitmq_user_permissions { ['dev@dev', 'admin@dev', "${bsg_rabbit::monitor_user}@dev"]:
    configure_permission => '.*',
    read_permission      => '.*',
    write_permission     => '.*',
  }
}

What are you seeing

Error: Failed to apply catalog: Cannot parse invalid user line: warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

What behaviour did you expect instead

vhosts/users created if needed

Output log

Any additional information you'd like to impart

Without the environment change, the debug log looks like this:

Info: Class[Rabbitmq::Config]: Scheduling refresh of Class[Rabbitmq::Service]
Info: Class[Rabbitmq::Service]: Scheduling refresh of Service[rabbitmq-server]
Debug: Executing: '/bin/systemctl is-active rabbitmq-server'
Debug: Executing: '/bin/systemctl is-enabled rabbitmq-server'
Debug: Executing: '/bin/systemctl is-active rabbitmq-server'
Debug: Executing: '/bin/systemctl restart rabbitmq-server'
Notice: /Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]: Triggered 'refresh' from 1 events
Debug: /Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]: The container Class[Rabbitmq::Service] will propagate my refresh event
Debug: Class[Rabbitmq::Service]: The container Stage[main] will propagate my refresh event
Debug: Class[Rabbitmq::Service]: The container Class[Rabbitmq] will propagate my refresh event
Debug: Class[Rabbitmq]: The container Stage[main] will propagate my refresh event
Debug: Prefetching rabbitmqctl resources for rabbitmq_user
Debug: Executing: '/sbin/rabbitmqctl -q status'
Debug: Executing: '/sbin/rabbitmqctl list_users -q --no-table-headers'
Debug: Command succeeded
Debug: Executing: '/sbin/rabbitmqctl eval rabbit_access_control:check_user_pass_login(list_to_binary("dev"), list_to_binary("dev")).'

With the environment change, it looks like this:

Info: Class[Rabbitmq::Config]: Scheduling refresh of Class[Rabbitmq::Service]
Info: Class[Rabbitmq::Service]: Scheduling refresh of Service[rabbitmq-server]
Debug: Executing: '/bin/systemctl is-active rabbitmq-server'
Debug: Executing: '/bin/systemctl is-enabled rabbitmq-server'
Debug: Executing: '/bin/systemctl is-active rabbitmq-server'
Debug: Executing: '/bin/systemctl restart rabbitmq-server'
Notice: /Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]: Triggered 'refresh' from 1 events
Debug: /Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]: The container Class[Rabbitmq::Service] will propagate my refresh event
Debug: Class[Rabbitmq::Service]: The container Stage[main] will propagate my refresh event
Debug: Class[Rabbitmq::Service]: The container Class[Rabbitmq] will propagate my refresh event
Debug: Class[Rabbitmq]: The container Stage[main] will propagate my refresh event
Debug: Prefetching rabbitmqctl resources for rabbitmq_user
Debug: Executing: '/sbin/rabbitmqctl -q status'
Debug: Executing: '/sbin/rabbitmqctl list_users -q --no-table-headers'
Debug: Command succeeded
Debug: Storing state
Debug: Stored state in 0.27 seconds
Error: Failed to apply catalog: Cannot parse invalid user line: warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

I've tried to run the commands that appear to be failing from the command line, but I'm having trouble getting the syntax correct. Here's what I've tried:

/sbin/rabbitmqctl eval 'rabbit_access_control:check_user_pass_login(list_to_binary("dev"),list_to_binary("dev"))'
Error (argument validation): "syntax error before: "
Arguments given:
	eval rabbit_access_control:check_user_pass_login(list_to_binary("dev"),list_to_binary("dev"))

It's because Rabbitmq's client tools seem to have problems with the language being set a certain way at the system level. While this really is more of a system config issue, we did add a workaround to set LC_ALL to en_US.UTF-8 by default:

rabbitmq::environment_variables:
'LC_ALL': 'en_US.UTF-8'

#694
rabbitmq/rabbitmq-server#1572

Since you're overriding this, you can either reconfigure your language settings system-wide, or add the value above to environment_variables instead of overriding it. We tried to take a relatively conservative approach to setting this, so that users could override it if they needed to.

Thanks! I set it at both the system-wide level and included it in the environment stanza just to be safe and that seems to have worked.