[Crowbar] Changing Crowbar Cookbook (rabbit ...)

Andi_Abes at Dell.com Andi_Abes at Dell.com
Thu Jan 19 17:00:12 CST 2012


One option to debug is to run chef client with debug logging, which will include both the actual command being executed and it's output.
Add
 -l debug 
to your chef command line.

To answer your q: - No. Crowbar does not mess with recipes. As a matter of fact, when I was testing our changes, I did exactly the steps you describe (plus the debug, and looking in the rabbit log to check it was happier, and Greg tested the initial deploy case - which is the next BTW).
(btw - the problem you're describing is exactly the one we were fixing on trunk, and you'd probably want to change that line to:
  not_if "test `rabbitmqctl list_user_permissions #{new_resource.user} | wc -l` -gt 2"

to catch the case where there are no user permissions currently there, but the user is defined, since list_user_permissions still returns 0 in that case)

one last BTW - for folks that will read this thread later:
the comments above apply to the rabbitmq cookbook in the crowbar barclamp. There are other cookbooks in the barclamp, which are applied early on in the crowbar install (& node install for that matter) that would require more of  a rebuild.


hth,
a

-----Original Message-----
From: Kevin Bringard [mailto:kbringard at atti.com] 
Sent: Thursday, January 19, 2012 5:50 PM
To: Abes, Andi; crowbar
Subject: Re: Changing Crowbar Cookbook

Yea, the problem the recipe in tag v1.2 is that it wads trying to run rabbitmqctl list_user_permissions | grep..., but that is the wrong syntax for the command. It needs to be "rabbitmqctl list_user_permissions $user", then you can grep to get your return value to key your not_if on. Because it was never finding the grep this was causing rabbit to restart every time it runs, which causes the queues to disconnect and reeks havoc.

But anyway, to my original question... I made the changes on my admin server and then knife the crowbar recipes into place, but the changes don't seem to be taken effect (at least not when I run chef-client manually). Is there any reason that should be happening? Based on our previous conversations I know crowbar builds some things out when a node is first discovered, but I wouldn't imagine this would be in that category since it's just a recipe...

Any ideas? I want to keep debugging, but it's super slow going when I have to rebuild the iso and redeploy the entire environment every time I want to test a change :-/

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/cook
>boo
>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