[Crowbar] Changing Crowbar Cookbook

Kevin Bringard kbringard at atti.com
Fri Jan 20 09:00:48 CST 2012


Cool, thanks for the info; I've updated and tested my local stuff and it
works great :-). Also, I glanced at your repo and noticed that the syntax
of the rabbitmqctl command is still wrong in the :clear_permissions
method, just FYI.

On 1/19/12 3:42 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:

>Hmm.. been there.
>This test works too well - it will not_if creating the permissions even
>if they don't already exist.
>
>We ended up with:
>not_if "test `rabbitmqctl list_user_permissions #{new_resource.user} | wc
>-l` -gt 2"
>
>
>Which is here:
>https://github.com/dellcloudedge/barclamp-crowbar/blob/master/chef/cookboo
>ks/rabbitmq/providers/user.rb#L39
>
>
>re: pull request to opsCode. Yes. we should be good citizens here. Alas,
>we haven't forked our original repo from theirs (we were'nt on github at
>the time).
>
>There's a whole process to submit pull requests to OpsCode, including
>signing a Contributor License Agreement (CLA), tickets (signup for their
>ticket system) and some other paperwork (which I have done).
>
>If you're already setup to do that, and can do that - great.
>Otherwise, I can try to get to it soon.
>
>
>
>
>-----Original Message-----
>From: crowbar-bounces On Behalf Of Kevin Bringard
>Sent: Thursday, January 19, 2012 5:37 PM
>To: Abes, Andi; crowbar
>Subject: Re: [Crowbar] Changing Crowbar Cookbook
>
>Shouldn't be... I'm updating a not_if to fix a syntax error in the
>rabbitmqctl list_user_permissions
>
>Here's my debugging output:
>
>[Thu, 19 Jan 2012 22:02:15 +0000] DEBUG: Processing execute[rabbitmqctl
>set_permissions -p /nova nova ".*" ".*" ".*"] on
>de8-9a-8f-a0-31-0c.ewr1.attcompute.com
>[Thu, 19 Jan 2012 22:02:15 +0000] INFO: Processing execute[rabbitmqctl
>set_permissions -p /nova nova ".*" ".*" ".*"] action run
>(/var/cache/chef/cookbooks/rabbitmq/providers/user.rb line 38) [Thu, 19
>Jan 2012 22:02:15 +0000] DEBUG: sh(rabbitmqctl list_user_permissions |
>grep nova) [Thu, 19 Jan 2012 22:02:15 +0000] INFO: execute[rabbitmqctl
>set_permissions -p /nova nova ".*" ".*" ".*"] sh(rabbitmqctl
>set_permissions -p /nova nova ".*" ".*" ".*") Setting permissions for
>user "nova" in vhost "/nova" ...
>...done.
>[Thu, 19 Jan 2012 22:02:15 +0000] INFO: execute[rabbitmqctl
>set_permissions -p /nova nova ".*" ".*" ".*"] ran successfully
>
>The lines I'm changing are here, specifically the not_if...
>
>
>action :set_permissions do
>  if new_resource.vhost
>    execute "rabbitmqctl set_permissions -p #{new_resource.vhost}
>#{new_resource.user} #{new_resource.permissions}" do
>      puts "User: #{new_resource.user}"
>      not_if "rabbitmqctl list_user_permissions #{new_resource.user} |
>grep #{new_resource.user}"
>      Chef::Log.info "Setting RabbitMQ user permissions for
>'#{new_resource.user}' on vhost #{new_resource.vhost}."
>      new_resource.updated_by_last_action(true)
>    end
>  else
>    execute "rabbitmqctl set_permissions #{new_resource.user}
>#{new_resource.permissions}" do
>      not_if "rabbitmqctl list_user_permissions #{new_resource.user} |
>grep #{new_resource.user}"
>      Chef::Log.info "Setting RabbitMQ user permissions for
>'#{new_resource.user}'."
>      new_resource.updated_by_last_action(true)
>    end
>  end
>end
>
>You can see that in my updated cookebook the line should be running
>"rabbitmqctl list_user_permissions #{new_resource.user} | grep
>#{new_resource.user}", but if you look at tbe debugging output, it's only
>running "rabbitmqctl list_user_permissions | grep #{new_resource.user}"
>(which is syntactically incorrect since version 2.5 of rabbit).
>
>
>Anyway, so yea, I don't get why the cookbook doesn't seem to be updating
>:-/
>
>I've forked the original opscode recipes, once I verify it's working I'm
>going to submit a pull request to them so it'll get upstream... Should I
>submit one to you guys as well, or will that get pulled in?
>
>On 1/19/12 3:22 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:
>
>>Duh... sorry.
>>
>>So, rabbit should be installed on the nova controller and on compute
>>nodes if you have Nova HA networking on.
>>
>>The steps you described should suffice (this time for real ;) ) to
>>update a recipes.
>>However, most of the recipes are written to be idempotent - is your
>>code by chance in a block that's conditionalzed in some way that would
>>prevent it from executing?
>>
>>(as a side note, if you do the pull thingie, it's an easy way to see
>>the deltas and comment on them... so my previous answer is not totally
>>not
>>relevant...;)
>>
>>a.
>>
>>
>>
>>-----Original Message-----
>>From: crowbar-bounces On Behalf Of Kevin Bringard
>>Sent: Thursday, January 19, 2012 5:20 PM
>>To: crowbar
>>Subject: Re: [Crowbar] Changing Crowbar Cookbook
>>
>>Thanks Andi,
>>
>>I get the pull procedure, I'm just trying to test my changes before I
>>setup a pull request. I updated the user.rb like I outlined below and
>>then knife cookbook upload -o . crowbar and run chef-client, but my
>>changes aren't showing up. Is there something else I need to do to get
>>my changes to take effect?
>>
>>-- Kevin
>>
>>On 1/19/12 3:15 PM, "Andi_Abes at Dell.com" <Andi_Abes at Dell.com> wrote:
>>
>>>You would have to create a pull request on git hub.
>>>
>>>To do that, create your own fork of the relevant repo, push your
>>>changes into that fork and then create a pull request.
>>>Here are some guides:
>>>* http://help.github.com/fork-a-repo/
>>>* http://help.github.com/send-pull-requests/
>>>
>>>
>>>I'll add a page on the wiki about how to contribute... should probably
>>>have had it.
>>>
>>>a.
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: crowbar-bounces On Behalf Of Kevin Bringard
>>>Sent: Thursday, January 19, 2012 4:41 PM
>>>To: crowbar
>>>Subject: [Crowbar] Changing Crowbar Cookbook
>>>
>>>Hey all,
>>>
>>>I found a bug in one of the OpsCode recpies... I updated it and was
>>>trying to push it into place, but it doesn't seem to be updating. Here
>>>is what I am doing (this is all on the crowbar admin node):
>>>
>>>Cd /opt/dell/barclamps/crowbar/chef/cookbooks
>>>Vi rabbitmq/providers/user.rb
>>>
>>><hack hack hack/>
>>>
>>>knife cookbook upload -o . Crowbar
>>>
>>>Then on the clients, I run chef-client and examine the output, but I
>>>don't see my changes (I put some puts in place for debugging).
>>>
>>>Am I missing something? Is there another step I need to be taking?
>>>
>>>Thanks!
>>>
>>>-- Kevin
>>>
>>>_______________________________________________
>>>Crowbar mailing list
>>>Crowbar at dell.com
>>>https://lists.us.dell.com/mailman/listinfo/crowbar
>>>For more information: https://github.com/dellcloudedge/crowbar/wiki
>>
>>_______________________________________________
>>Crowbar mailing list
>>Crowbar at dell.com
>>https://lists.us.dell.com/mailman/listinfo/crowbar
>>For more information: https://github.com/dellcloudedge/crowbar/wiki
>
>_______________________________________________
>Crowbar mailing list
>Crowbar at dell.com
>https://lists.us.dell.com/mailman/listinfo/crowbar
>For more information: https://github.com/dellcloudedge/crowbar/wiki



More information about the Crowbar mailing list