puppet-rabbitmq icon indicating copy to clipboard operation
puppet-rabbitmq copied to clipboard

Setting 'RABBITMQ_USE_LONGNAME' to true causes failures during user add

Open bsg-sfrazer opened this issue 5 years ago • 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"))

bsg-sfrazer avatar Aug 29 '19 21:08 bsg-sfrazer

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:

https://github.com/voxpupuli/puppet-rabbitmq/blob/75574b8f4a921cacda86ff30d378308084afa0d4/data/common.yaml#L82-L83 https://github.com/voxpupuli/puppet-rabbitmq/pull/694 https://github.com/rabbitmq/rabbitmq-server/issues/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.

wyardley avatar Aug 30 '19 03:08 wyardley

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.

bsg-sfrazer avatar Aug 30 '19 15:08 bsg-sfrazer