# Which cookbook version wins in this case?

**URL:** <https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393>\
**Category:** Chef Infra (archive)\
**Created:** [March 10, 2015, 9:23pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393 "2015-03-10T21:23:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [March 10, 2015, 9:23pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/1 "2015-03-10T21:23:58Z")

</div>

Say I have a web\_role cookbook, and its metadata.rb file looks like this

depends ‘apache’, '= 1.0.0’  
depends ‘webapp’, '= 1.0.0’  
depends ‘someapp’, ‘= 1.0.0’

…and my webapp cookbook’s metadata.rb files look like…

depends ‘apache’ # Not pinned to any version

On the server I have apache@1.0.0[mailto:apache@1.0.0](mailto:apache@1.0.0) and apache@1.2.0[mailto:apache@1.2.0](mailto:apache@1.2.0) versions of the apache cookbook

Now if I add my web\_role cookbook to my node’s run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role’s metadata.rb file, or the 1.2.0, latest version on the chef server?

Chris

---

<div class="post-metadata">

**Author:** ![drpebcak](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@drpebcak](https://discourse.chef.io/u/drpebcak)\
**Post date:** [March 11, 2015, 2:45am UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/2 "2015-03-11T02:45:46Z")

</div>

1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.

> On Mar 10, 2015, at 2:23 PM, Fouts, Chris [Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) wrote:
> 
> Say I have a web\_role cookbook, and its metadata.rb file looks like this
> 
> depends ‘apache’, ‘= 1.0.0’  
> depends ‘webapp’, ‘= 1.0.0’  
> depends ‘someapp’, ‘= 1.0.0’
> 
> …and my webapp cookbook’s metadata.rb files look like…
> 
> depends ‘apache’ # Not pinned to any version
> 
> On the server I have apache@1.0.0 and apache@1.2.0 versions of the apache cookbook
> 
> Now if I add my web\_role cookbook to my node’s run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role’s metadata.rb file, or the 1.2.0, latest version on the chef server?
> 
> Chris

---

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [March 11, 2015, 4:39pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/3 "2015-03-11T16:39:39Z")

</div>

Thanks. I’m testing this now. How do I show the cookbooks’ version that converged on the node? “knife node show” of course shows the run list, but not the cookbooks’ versions?

Chris

From: Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
Sent: Tuesday, March 10, 2015 10:46 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Which cookbook version wins in this case?

1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.

On Mar 10, 2015, at 2:23 PM, Fouts, Chris \<[Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com)[mailto:Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com)\> wrote:  
Say I have a web\_role cookbook, and its metadata.rb file looks like this

depends ‘apache’, ‘= 1.0.0’  
depends ‘webapp’, ‘= 1.0.0’  
depends ‘someapp’, ‘= 1.0.0’

…and my webapp cookbook’s metadata.rb files look like…

depends ‘apache’ # Not pinned to any version

On the server I have apache@1.0.0[mailto:apache@1.0.0](mailto:apache@1.0.0) and apache@1.2.0[mailto:apache@1.2.0](mailto:apache@1.2.0) versions of the apache cookbook

Now if I add my web\_role cookbook to my node’s run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role’s metadata.rb file, or the 1.2.0, latest version on the chef server?

Chris

---

<div class="post-metadata">

**Author:** ![drpebcak](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@drpebcak](https://discourse.chef.io/u/drpebcak)\
**Post date:** [March 11, 2015, 4:58pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/4 "2015-03-11T16:58:27Z")

</div>

You could always examine the cookbook on your node - it should be in chef's  
cache directory after convergence. There may be a knife plugin somewhere  
that will show you cookbook version resolution based on a node's run list.

On Wed, Mar 11, 2015 at 9:39 AM, Fouts, Chris [Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)  
wrote:

> Thanks. I’m testing this now. How do I show the cookbooks’ version that  
> converged on the node? “knife node show” of course shows the run list, but  
> not the cookbooks’ versions?
> 
> Chris
> 
> _From:_ Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
> _Sent:_ Tuesday, March 10, 2015 10:46 PM  
> _To:_ [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> _Subject:_ [chef] Re: Which cookbook version wins in this case?
> 
> 1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.
> 
> On Mar 10, 2015, at 2:23 PM, Fouts, Chris [Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) wrote:
> 
> Say I have a web\_role cookbook, and its metadata.rb file looks like this
> 
> depends ‘apache’, ‘= 1.0.0’
> 
> depends ‘webapp’, ‘= 1.0.0’
> 
> depends ‘someapp’, ‘= 1.0.0’
> 
> …and my webapp cookbook’s metadata.rb files look like…
> 
> depends ‘apache’ # Not pinned to any version
> 
> On the server I have apache@1.0.0 and apache@1.2.0 versions of the apache  
> cookbook
> 
> Now if I add my web\_role cookbook to my node’s run list, which version of  
> the apache cookbook will converge, 1.0.0 defined in the web\_role’s  
> metadata.rb file, or the 1.2.0, latest version on the chef server?
> 
> Chris

---

<div class="post-metadata">

**Author:** ![luckymike](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/luckymike/32/134_2.png) [@luckymike](https://discourse.chef.io/u/luckymike)\
**Post date:** [March 11, 2015, 5:03pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/5 "2015-03-11T17:03:56Z")

</div>

I believe you'll find the versions used at the top of the client log as  
well, e.g. "nginx@3.0.1"

--  
_Michael F. Weinberg | Director of Operations_  
[http://heavywaterops.com](http://heavywaterops.com) | @heavywaterops

On Wed, Mar 11, 2015 at 9:58 AM, tayworm . [tayworm@gmail.com](mailto:tayworm@gmail.com) wrote:

> You could always examine the cookbook on your node - it should be in  
> chef's cache directory after convergence. There may be a knife plugin  
> somewhere that will show you cookbook version resolution based on a node's  
> run list.
> 
> On Wed, Mar 11, 2015 at 9:39 AM, Fouts, Chris [Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)  
> wrote:
> 
> > Thanks. I’m testing this now. How do I show the cookbooks’ version that  
> > converged on the node? “knife node show” of course shows the run list, but  
> > not the cookbooks’ versions?
> > 
> > Chris
> > 
> > _From:_ Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
> > _Sent:_ Tuesday, March 10, 2015 10:46 PM  
> > _To:_ [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > _Subject:_ [chef] Re: Which cookbook version wins in this case?
> > 
> > 1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.
> > 
> > On Mar 10, 2015, at 2:23 PM, Fouts, Chris [Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) wrote:
> > 
> > Say I have a web\_role cookbook, and its metadata.rb file looks like this
> > 
> > depends ‘apache’, ‘= 1.0.0’
> > 
> > depends ‘webapp’, ‘= 1.0.0’
> > 
> > depends ‘someapp’, ‘= 1.0.0’
> > 
> > …and my webapp cookbook’s metadata.rb files look like…
> > 
> > depends ‘apache’ # Not pinned to any version
> > 
> > On the server I have apache@1.0.0 and apache@1.2.0 versions of the  
> > apache cookbook
> > 
> > Now if I add my web\_role cookbook to my node’s run list, which version of  
> > the apache cookbook will converge, 1.0.0 defined in the web\_role’s  
> > metadata.rb file, or the 1.2.0, latest version on the chef server?
> > 
> > Chris

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [March 11, 2015, 5:05pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/6 "2015-03-11T17:05:14Z")

</div>

Noah wrote a knife plugin to ask the server what cookbooks it would give you: [GitHub - coderanger/knife-solve: A knife plugin to see the Chef Server version solver solution for a given set of cookbooks.](https://github.com/coderanger/knife-solve)

--  
Daniel DeLeo

On Wednesday, March 11, 2015 at 10:03 AM, Michael Weinberg wrote:

> I believe you'll find the versions used at the top of the client log as well, e.g. "nginx@3.0.1 ([mailto:nginx@3.0.1](mailto:nginx@3.0.1))"
> 
> --Michael F. Weinberg | Director of Operations  
> [http://heavywaterops.com](http://heavywaterops.com) | @heavywaterops
> 
> On Wed, Mar 11, 2015 at 9:58 AM, tayworm . \<[tayworm@gmail.com](mailto:tayworm@gmail.com) ([mailto:tayworm@gmail.com](mailto:tayworm@gmail.com))\> wrote:
> 
> > You could always examine the cookbook on your node - it should be in chef's cache directory after convergence. There may be a knife plugin somewhere that will show you cookbook version resolution based on a node's run list.
> > 
> > On Wed, Mar 11, 2015 at 9:39 AM, Fouts, Chris \<[Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com) ([mailto:Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com))\> wrote:
> > 
> > > Thanks. I’m testing this now. How do I show the cookbooks’ version that converged on the node? “knife node show” of course shows the run list, but not the cookbooks’ versions?
> > > 
> > > Chris
> > > 
> > > From: Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
> > > Sent: Tuesday, March 10, 2015 10:46 PM  
> > > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com) ([mailto:chef@lists.opscode.com](mailto:chef@lists.opscode.com))  
> > > Subject: [chef] Re: Which cookbook version wins in this case?
> > > 
> > > 1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.
> > > 
> > > On Mar 10, 2015, at 2:23 PM, Fouts, Chris \<[Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) ([mailto:Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com))\> wrote:
> > > 
> > > > Say I have a web\_role cookbook, and its metadata.rb file looks like this
> > > > 
> > > > depends ‘apache’, ‘= 1.0.0’  
> > > > depends ‘webapp’, ‘= 1.0.0’  
> > > > depends ‘someapp’, ‘= 1.0.0’
> > > > 
> > > > …and my webapp cookbook’s metadata.rb files look like…
> > > > 
> > > > depends ‘apache’ # Not pinned to any version
> > > > 
> > > > On the server I have apache@1.0.0 ([mailto:apache@1.0.0](mailto:apache@1.0.0)) and apache@1.2.0 ([mailto:apache@1.2.0](mailto:apache@1.2.0)) versions of the apache cookbook
> > > > 
> > > > Now if I add my web\_role cookbook to my node’s run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role’s metadata.rb file, or the 1.2.0, latest version on the chef server?
> > > > 
> > > > Chris

---

<div class="post-metadata">

**Author:** ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)\
**Post date:** [March 11, 2015, 5:08pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/7 "2015-03-11T17:08:51Z")

</div>

You may use a report handler for this:

An example one with this use case is available on the doc site here:

> **[About Handlers](https://docs.chef.io/handlers/)**
>
> Use a handler to identify situations that arise during a Chef Infra Client run, and then tell Chef Infra Client how to handle these situations when they occur.

Le 2015-03-11 17:39, Fouts, Chris a écrit :

> Thanks. I'm testing this now. How do I show the cookbooks' version that converged on the node? "knife node show" of course shows the run list, but not the cookbooks' versions?
> 
> Chris
> 
> FROM: Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
> SENT: Tuesday, March 10, 2015 10:46 PM  
> TO: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> SUBJECT: [chef] Re: Which cookbook version wins in this case?
> 
> 1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.
> 
> On Mar 10, 2015, at 2:23 PM, Fouts, Chris [Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) wrote:
> 
> > Say I have a web\_role cookbook, and its metadata.rb file looks like this
> > 
> > depends 'apache', '= 1.0.0'
> > 
> > depends 'webapp', '= 1.0.0'
> > 
> > depends 'someapp', '= 1.0.0'
> > 
> > ...and my webapp cookbook's metadata.rb files look like...
> > 
> > depends 'apache' # Not pinned to any version
> > 
> > On the server I have apache@1.0.0 and apache@1.2.0 versions of the apache cookbook
> > 
> > Now if I add my web\_role cookbook to my node's run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role's metadata.rb file, or the 1.2.0, latest version on the chef server?
> > 
> > Chris

---

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [March 12, 2015, 2:30pm UTC](https://discourse.chef.io/t/which-cookbook-version-wins-in-this-case/6393/8 "2015-03-12T14:30:27Z")

</div>

I explore that, thanks!

Chris

From: Tensibai [[mailto:tensibai@iabis.net](mailto:tensibai@iabis.net)]  
Sent: Wednesday, March 11, 2015 1:09 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: RE: Re: Which cookbook version wins in this case?

You may use a report handler for this:

An example one with this use case is available on the doc site here: [http://docs.chef.io/handlers.html#cookbook-versions-rb](http://docs.chef.io/handlers.html#cookbook-versions-rb)

Le 2015-03-11 17:39, Fouts, Chris a écrit :  
Thanks. I’m testing this now. How do I show the cookbooks’ version that converged on the node? “knife node show” of course shows the run list, but not the cookbooks’ versions?

Chris

From: Taylor Price [[mailto:tayworm@gmail.com](mailto:tayworm@gmail.com)]  
Sent: Tuesday, March 10, 2015 10:46 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)[mailto:chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Which cookbook version wins in this case?

1.0.0 should win. It satisfies all requirements, where 1.2.0 does not.

On Mar 10, 2015, at 2:23 PM, Fouts, Chris \<[Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com)[mailto:Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com)\> wrote:  
Say I have a web\_role cookbook, and its metadata.rb file looks like this

depends ‘apache’, '= 1.0.0’  
depends ‘webapp’, '= 1.0.0’  
depends ‘someapp’, ‘= 1.0.0’

…and my webapp cookbook’s metadata.rb files look like…

depends ‘apache’ # Not pinned to any version

On the server I have apache@1.0.0[mailto:apache@1.0.0](mailto:apache@1.0.0) and apache@1.2.0[mailto:apache@1.2.0](mailto:apache@1.2.0) versions of the apache cookbook

Now if I add my web\_role cookbook to my node’s run list, which version of the apache cookbook will converge, 1.0.0 defined in the web\_role’s metadata.rb file, or the 1.2.0, latest version on the chef server?

Chris
