# Wrapper Cookbook Not Pulling Latest Version of Referenced Cookbook

**URL:** <https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483>\
**Category:** Chef Infra (archive)\
**Created:** [May 16, 2016, 11:19pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483 "2016-05-16T23:19:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcderose](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jcderose/32/1149_2.png) [@jcderose](https://discourse.chef.io/u/jcderose)\
**Post date:** [May 16, 2016, 11:19pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/1 "2016-05-16T23:19:38Z")

</div>

I’m running Chef Server 12.2.0, and I’ve noticed an odd behavior with one of my wrapper cookbooks - it doesn’t use the latest versions of cookbooks uploaded to the Chef server.

On the Chef server, we have two custom cookbooks, `cookbookA` v 0.1.28 and `cookbookB` v 0.2.11. `cookbookB` references `cookbookA` like so:

```auto
# cookbookB/recipes/default
include_recipe 'cookbookA::some_recipe'

```

```auto
# cookbookB/metadata.rb
...
version '0.2.11'

depends 'cookbookA'

```

```auto
# cookbookB/Berksfile
source 'https://supermarket.chef.io'

metadata

cookbook 'cookbookA', git: 'git@github.com:user/chef-repo.git', rel: 'cookbookA'

```

However, all nodes running the `cookbookB::default` recipe call `cookbookA` version 0.1.16 rather than version 0.1.28. Any idea how I can fix this without hard-coding the `cookbookA` version in `cookbookB/metadata.rb`?

---

<div class="post-metadata">

**Author:** ![coderanger](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/coderanger/32/5_2.png) [@coderanger](https://discourse.chef.io/u/coderanger)\
**Post date:** [May 16, 2016, 11:24pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/2 "2016-05-16T23:24:20Z")

</div>

The `Berksfile` has no effect on Chef’s version solver. It sounds like Policyfiles are more of what you are looking for if you want to pull snapshots from git and have production obey them. Otherwise if `B` depends on a specific version of `A` then the dependency metadata should reflect that.

---

<div class="post-metadata">

**Author:** ![alainchiasson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/alainchiasson/32/1172_2.png) [@alainchiasson](https://discourse.chef.io/u/alainchiasson)\
**Post date:** [May 17, 2016, 12:13pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/3 "2016-05-17T12:13:06Z")

</div>

As a side question on this - dependancy resolution - we have quite a few cookbooks that depend on other cookbooks and make use of “version pinning” using environment cookbooks (we have not moved to policy files yet). Once in a while, because of some obscure dependancy of a dependency not under our control, we can never get the latest version of our own cookbooks. We can isolated who is responsible by removing the cookbooks that we know - but it is still pretty long.

Is there a way to see how the decision was made and pinpoint which cookbook constraint is responsible ?

This happens both in development with Berks and when converging via chef-client.

---

<div class="post-metadata">

**Author:** ![jcderose](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jcderose/32/1149_2.png) [@jcderose](https://discourse.chef.io/u/jcderose)\
**Post date:** [May 17, 2016, 4:05pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/4 "2016-05-17T16:05:30Z")

</div>

Thanks, Noah! One follow-up question: I’m now running into mixed dependency problems where two separate cookbook dependencies require two separate versions of ohai:

```auto
$ chef install
Building policy my-cookbook
Expanded run list: recipe[my-cookbook::default]
Caching Cookbooks...
Installing my-cookbook >= 0.0.0 from path
Installing other-cookbook1 >= 0.0.0 from git
Installing other-cookbook2 >= 0.0.0 from path
Installing other-cookbook3 >= 0.0.0 from path
Installing other-cookbook4 >= 0.0.0 from path
Installing other-cookbook5 >= 0.0.0 from git
Error: Failed to generate Policyfile.lock
Reason: (Solve::Errors::NoSolutionError) Unable to satisfy the following requirements:

- `ohai (~> 3.0)` required by `sysctl-0.7.5`
- `ohai (~> 2.0)` required by `nginx-2.7.6`

```

Do I have any options besides (1) downgrading `sysctl` to a version compatible with `ohai (~> 2.0)` or (2) opening an issue with the `nginx` repo requesting they upgrade their ohai dependency to `ohai (~> 3.0)`?

---

<div class="post-metadata">

**Author:** ![nclemons](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/nclemons/32/3374_2.png) [@nclemons](https://discourse.chef.io/u/nclemons)\
**Post date:** [May 17, 2016, 4:23pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/5 "2016-05-17T16:23:54Z")

</div>

You may want to look at Noah’s knife-solve plugin.

Nathan Clemons  
DevOps Engineer  
Moxie Cloud Services (MCS)

O +1.425.467.5075  
M +1.360.861.6291  
E [nclemons@gomoxie.com](mailto:nclemons@gomoxie.com)  
W [www.gomoxie.com](http://www.gomoxie.com)[http://www.gomoxie.com/](http://www.gomoxie.com/)

---

<div class="post-metadata">

**Author:** ![alainchiasson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/alainchiasson/32/1172_2.png) [@alainchiasson](https://discourse.chef.io/u/alainchiasson)\
**Post date:** [May 17, 2016, 5:20pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/6 "2016-05-17T17:20:35Z")

</div>

Thanks @nclemons

While it does give me the list, I still end up wit the same probelms. EG (I renamed / removed cookbooks for display):

± |master ?:3 ✗| → knife solve corp\_sys corp\_rr  
Solving [corp\_sys, corp\_rr] in \_default environment

\<\<\< aprox 20 cookbooks \>\>\>  
…  
corp\_rr 0.3.0  
corp\_sys 3.0.18  
…

± |master ?:3 ✗| → knife cookbook list  
…  
corp\_rr 0.5.14  
corp\_sys 3.0.18  
…

As you can see the resolver is NOT getting the latest corp\_rr - this is in the unconstrained default environment. I know this happens because somewhere in the dependency list ( 20+ cookbooks) there is a restriction that bubbles up. I want that displayed. I will look at what @jcderose was doing with the chef install above - is that the actual output ? but in my case - it does resolve, but I need to know which cookbook forced the constraint.

---

<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:** [May 17, 2016, 8:00pm UTC](https://discourse.chef.io/t/wrapper-cookbook-not-pulling-latest-version-of-referenced-cookbook/8483/7 "2016-05-17T20:00:43Z")

</div>

You might consider Batali as an alternative solver. It can resolve branching dependency trees (giving you a copy of each version) so that you can install all the cookbooks that will be needed on the server.

Batali: [https://github.com/hw-labs/batali](https://github.com/hw-labs/batali)

For more on the usage and rationale, we have a blog post here: [http://www.heavywater.io/blog/2015/03/17/batali/](http://www.heavywater.io/blog/2015/03/17/batali/)
