Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rabbitmq_exchange resource produces errors #149

Closed
matthewbarr opened this issue Dec 6, 2013 · 5 comments
Closed

Rabbitmq_exchange resource produces errors #149

matthewbarr opened this issue Dec 6, 2013 · 5 comments

Comments

@matthewbarr
Copy link

root@puppet:/etc/puppet# puppet resource rabbitmq_exchange
Error: Could not run: Execution of '/usr/local/bin/rabbitmqadmin list exchanges' returned 1: Traceback (most recent call last):
File "/usr/local/bin/rabbitmqadmin", line 939, in
main()
File "/usr/local/bin/rabbitmqadmin", line 370, in main
(options, args) = make_configuration()
File "/usr/local/bin/rabbitmqadmin", line 319, in make_configuration
config_file = default_config()
File "/usr/local/bin/rabbitmqadmin", line 310, in default_config
return home + os.sep + ".rabbitmqadmin.conf"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

This is with 3.1.0, and a 3.3.2 of puppet. It's also produced by the mcollective module, when it tries to add exchanges.

I suspect that it's having a problem parsing the output of the command. Rabbit version 3.2.1

I'm going to go looking at the code now.

@matthewbarr
Copy link
Author

What's odd is that it looks like that's a python error, not a ruby one. I can run the commands that the mcollective module is trying without an issue on the command line without issue. Only when it's run by puppet is it an issue.

(This is a vagrant install of mcollective, for testing and debugging this problem. it uses the defaults :)

Error: Could not prefetch rabbitmq_exchange provider 'rabbitmqadmin': Execution of '/usr/local/bin/rabbitmqadmin list exchanges' returned 1: Traceback (most recent call last):
File "/usr/local/bin/rabbitmqadmin", line 939, in
main()
File "/usr/local/bin/rabbitmqadmin", line 370, in main
(options, args) = make_configuration()
File "/usr/local/bin/rabbitmqadmin", line 319, in make_configuration
config_file = default_config()
File "/usr/local/bin/rabbitmqadmin", line 310, in default_config
return home + os.sep + ".rabbitmqadmin.conf"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Error: Execution of '/usr/local/bin/rabbitmqadmin declare exchange --vhost=/mcollective --user=admin --password=secret name=mcollective_broadcast type=topic' returned 1: Traceback (most recent call last):
File "/usr/local/bin/rabbitmqadmin", line 939, in
main()
File "/usr/local/bin/rabbitmqadmin", line 370, in main
(options, args) = make_configuration()
File "/usr/local/bin/rabbitmqadmin", line 319, in make_configuration
config_file = default_config()
File "/usr/local/bin/rabbitmqadmin", line 310, in default_config
return home + os.sep + ".rabbitmqadmin.conf"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

@matthewbarr
Copy link
Author

Found the issue: RabbitMQ 3.2.0 broke the behavior of the provider. The command doesn't work when run via puppet.

Using the rabbitmqadmin from 3.1.5, - https://raw.github.com/rabbitmq/rabbitmq-management/rabbitmq_v3_1_5/bin/rabbitmqadmin - the provider works just perfectly.

I've opened a bug on their side, since this shouldn't break,
rabbitmq/rabbitmq-management#10

Would it be easier to just the API for this? vs getting rabbitmqadmin?

@maxpwil
Copy link

maxpwil commented Dec 9, 2013

This error appears because the puppet user has no bash configuration by default. (keyword: /etc/passwd)
Just as quick fix proposal you can do something like this:

define components::rabbitmq::exchange (
  $vhost    = '',
  $type     = '',
  $user     = '',
  $password = '',
) {

  exec { "declare exchange ${name}":
    command     => "/usr/local/bin/rabbitmqadmin declare exchange --vhost=${vhost} --user=${user} --password=${password} name=${name} type=${type}",
    environment => 'HOME=/var/lib/puppet:/bin/bash',
    user        => 'root'
  }
}

@matthewbarr
Copy link
Author

Thanks- i'd love to use that, but... the call is actually by the puppetlabs-mcollective module, and i'd prefer to avoid patching that.

For now, i'm just putting the "right" version of the admin tool into the correct place, so the code doesn't try to download it. That way, the type call actually works.

@matthewbarr
Copy link
Author

Looks like it was resolved in RMQ 3.2.2, via my bug 25920.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants