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

Already on GitHub? Sign in to your account

COOK-2153 Fixed idempotence issues with user LWRP #31

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

By incorrectly I mean it was using incorrect combination of
list_user_permissions command which was making the LWRP to be
NON-idempotent and was setting the permissions when they already
have been set. According to docs the correct commands are:

list_user_permissions [-p ]

ie. you MUST supply the username as it's a mandatory argument.

Examples:

[sensu] ~ $ sudo rabbitmqctl list_user_permissions |foo
Error: invalid command 'list_user_permissions'
[sensu] ~ $ sudo rabbitmqctl list_user_permissions |sensu
Error: invalid command 'list_user_permissions'
[sensu] ~ $ sudo rabbitmqctl list_user_permissions sensu
Listing permissions for user "sensu" ...
/sensu .* .* .*
...done.
[sensu] ~ $ sudo rabbitmqctl list_user_permissions -p /sensu sensu
Listing permissions for user "sensu" ...
/sensu .* .* .*
...done.
[sensu] ~ $

Fixed the user LWRP as it was setting permissions incorrectly.
By incorrectly I mean it was using incorrect combination of
list_user_permissions command which was making the LWRP to be
NON-idempotent and was setting the permissions when they already
have been set. According to docs the correct commands are:

list_user_permissions [-p <vhostpath>] <username>

ie. you MUST supply the username as it's a mandatory argument.
Contributor

mattray commented Feb 20, 2013

I'm merging this, but it's not completely right yet.

rabbitmqctl list_user_permissions sensu

will return nothing if the user has no privileges, but does exist. Error code is the same either way, so it would disallow you from setting privileges. Working on a fix.

Contributor

mattray commented Feb 20, 2013

Going to use this:
rabbitmqctl -q list_user_permissions sensu | grep "^/"

Contributor

mattray commented Feb 22, 2013

Fixed in upcoming 2.0 branch here: https://github.com/mattray/rabbitmq/tree/2.0
The regex got a little more accurate too
rabbitmqctl -q list_user_permissions #{name} | grep "^#{vhost}\s""

@mattray mattray closed this Feb 22, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment