Howto read cookbook version info from metadata.rb in recipe by runtime on a node


#1

Hi, is there a way to use the ‘version’ info from the metadata of a cookbook in a recipe?

mfg
oleg


#2

Oleg,

You might be looking for this:
http://wiki.opscode.com/display/chef/Environments#Environments-cookbookversions

-Mike

On Mon, Oct 29, 2012 at 10:17 AM, oleg.volotov@gmx.de wrote:

Hi, is there a way to use the ‘version’ info from the metadata of a cookbook in a recipe?

mfg
oleg


#3

On Mon, Oct 29, 2012 at 3:32 PM, Mike miketheman@gmail.com wrote:

Oleg,

You might be looking for this:

http://wiki.opscode.com/display/chef/Environments#Environments-cookbookversions

Mike: I don’t think that’s what he’s asking for…

Oleg: try

run_context.cookbook_collection[cookbook].metadata.version


#4

THATS IT!!, thanks.

e.g. run_context.cookbook_collection[“mycookbook”].metadata.version

I’ve been looking the libs on GitHub (https://github.com/opscode/chef/tree/master/chef/lib/chef) and there I found the cookbook_collection already. But I dont know how to get the reference of it.

Therefore I wanted to ask, is there a page or pages on which you can read exactly how chef works, so that when class is loaded or something like that?

Also a page for a view from programmers?

mfg
oleg

-------- Original-Nachricht --------

Datum: Mon, 29 Oct 2012 16:30:22 +0100
Von: Andrea Campi andrea.campi@zephirworks.com
An: chef@lists.opscode.com
Betreff: [chef] Re: Re: Howto read cookbook version info from metadata.rb in recipe by runtime on a node

On Mon, Oct 29, 2012 at 3:32 PM, Mike miketheman@gmail.com wrote:

Oleg,

You might be looking for this:

http://wiki.opscode.com/display/chef/Environments#Environments-cookbookversions

Mike: I don’t think that’s what he’s asking for…

Oleg: try

run_context.cookbook_collection[cookbook].metadata.version