- From: Florian Hehlen <
>
- To: "'
'" <
>
- Subject: [chef] RE: Re: which cookbook version used in chef-client run?
- Date: Thu, 10 Oct 2013 13:24:21 +0000
- Accept-language: en-GB, en-US
It would be really good to have this logged by default. I got into a problem
where as far as I can see chef chose to one version over an other of recipe
and it took me a while to figure out that this was happening. Having the
versions logged would have helped identify the problem.
Here is what happened. Imagine three cookbooks A,B, C. B and C depend on A.
But they don't necessarily depend on the same version of A because B and C
just do different things. Now imagine B depends explicitly on version 1 of A
and C depends explicitly on version 2 of A. Finally lets say I add B and C to
the run list of a node.
The question is: Which version of A will be used? What I saw was that version
1 was being used for both. Has anyone else experienced this? Is this expected
behavior. It does not seem to respect the cookbook' depends' contract.
Cheers,
Florian
-----Original Message-----
From: Julian C. Dunn
[mailto:
Sent: 10 October 2013 14:44
To:
Subject: [chef] Re: which cookbook version used in chef-client run?
It's a little dirty, but if you crack open the run context you can do it:
---8<--- cut here ---8<---
log "---Writing all ckbks and versions---"
cookbooks = @run_context.cookbook_collection
log "The recipes were these: #{cookbooks.keys.map {|x| cookbooks[x].name + "
" + cookbooks[x].version} }"
log "---End Writing all ckbks and versions---
---8<--- cut here ---8<---
Credit goes to Sean Horn for this tidbit of code.
- Julian
On Thu, Oct 10, 2013 at 6:03 AM, Florian Hehlen
<
>
wrote:
>
Hi,
>
>
>
>
Is there a way to list or to log which cookbook version was used
>
during a chef-client run. I know I can crack open metadata.rb files in
>
the chef/cache directory but that is a bit clunky. It is also usefull
>
information to log I would say.
>
>
>
>
Cheers,
>
>
Flo
--
[ Julian C. Dunn
<
>
* Sorry, I'm ]
[ WWW:
http://www.aquezada.com/staff/julian * only Web 1.0 ]
[
gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]
LEGAL DISCLAIMER
This communication and any attached documents are strictly confidential
and/or legally privileged and they may not be used or disclosed by someone
who is not a named recipient. If you have received this electronic
communication in error please notify the sender by replying to this
electronic communication inserting the word "misdirected" as the subject and
delete this communication from your system.
Archive powered by MHonArc 2.6.16.