[chef-dev] RE: Re: get calling recipe


Chronological Thread 
  • From: Dave Urschatz < >
  • To: Rajiv Ranganath < >, Noah Kantrowitz < >
  • Cc: " " < >
  • Subject: [chef-dev] RE: Re: get calling recipe
  • Date: Tue, 10 Jun 2014 15:35:36 +0000
  • Accept-language: en-US

Thanks Rajiv.

I will look into this.

Regards,
Dave

-----Original Message-----
From: Rajiv Ranganath 
[mailto:
 
Sent: Monday, June 09, 2014 8:40 PM
To: Noah Kantrowitz
Cc: Dave Urschatz; 

Subject: Re: [chef-dev] Re: get calling recipe

Have you tried node.run_state?

Its a Hash available on the node object that you can use.

https://github.com/opscode/chef/blob/master/lib/chef/node.rb#L72

Notifications and Subscriptions can change the order in which resources get 
executed. So please do keep that in mind.

See - "Chef’s dirty secret: Convergence is also Compilation"

http://erik.hollensbe.org/2013/03/16/the-chef-resource-run-queue/

Best,
Rajiv

On Mon, Jun 9, 2014 at 4:58 PM, Noah Kantrowitz 
< >
 wrote:
> There is no "calling recipe" per se, all recipes are executed independently 
> so there isn't a useful call stack if thats what you mean. You can access 
> the _current_ cookbook/recipe via cookbook_name and recipe_name.
>
> --Noah
>
> On Jun 9, 2014, at 1:38 PM, Dave Urschatz 
> < >
>  wrote:
>
>>
>> Is there a way to get the name of a calling recipe?
>>
>> Say cookbook1::recipe-a has:
>>  include_recipe "cookbook2::recipe-b"
>>
>> Then in cookbook2::recipe-b we have:
>> puts get_calling_recipe.name
>>
>> Regards,
>> Dave
>



Archive powered by MHonArc 2.6.16.

§