# Why is berks install not getting latest cookbook version from Berks API server?

**URL:** <https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822>\
**Category:** Chef Infra (archive)\
**Created:** [August 19, 2015, 10:04pm UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822 "2015-08-19T22:04:13Z")\
**Posts on this page:** 5\
**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:** [August 19, 2015, 10:04pm UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822/1 "2015-08-19T22:04:13Z")

</div>

I uploaded my latest linux\_role cookbook to my Berks API server, which is just an organization on my Chef server accessed via port 26200. Hence I see

$ knife node show linux\_role  
linux\_role 1.1.80 1.1.79 1.1.78 1.1.77 1.1.76 1.1.75 1.1.74 1.1.72 1.1.71 1.1.70 1.1.69 1.1.68 1.1.67 1.1.66 1.1.65 1.1.64 1.1.63

Now I want to upload v1.1.80 to my Chef server.

First I have to run berks install so I get the cookbook from my Berks API server to my workstation correct? So I do

$ berks install  
Installing linux\_role (1.1.79) from [http://chef-server.domain.com:26200](http://chef-server.domain.com:26200) ([chef\_server] [https://chef-server.domain.com:443/organizations/berks-api](https://chef-server.domain.com:443/organizations/berks-api))

Why doesn’t it pick up v1.1.80? How can I make it pick up v1.1.80? I even restarted the berks-api service to no avail.

Here’s my Berksfile  
source "[http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)"  
metadata  
Here’s the corresponding metadata.rb file  
name "top\_level\_metadata"  
depends ‘linux\_role’, '~\> 1.1.0’  
I don’t necessarily want to change the version to ‘= 1.1.80’ because I have other role cookbooks that depends on linux\_role, which means I’ll have to update it’s version in their metadata.rb file, which means I have to update their version. Other cookbooks in turn depend on them so… the cycle continues.  
What am I missing?  
Chris

---

<div class="post-metadata">

**Author:** ![Eric\_Helgeson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eric_helgeson/32/67_2.png) [@Eric\_Helgeson](https://discourse.chef.io/u/Eric_Helgeson)\
**Post date:** [August 20, 2015, 2:36am UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822/2 "2015-08-20T02:36:41Z")

</div>

~\> is pessimistic

From the docs[0]:

> ~\>(approximately greater than; also known as “_pessimistically_ _greater  
> than_”, or “_pessimistic_”),

​That means it will take the lowest version that fits the constraints given.

​If you're following semantec versioning you could set  
depends 'linux\_role', '\>= 1.1.0'  
​which should pickup all versions in the 1.1.x range​

[0] ​[metadata.rb](https://docs.chef.io/config_rb_metadata.html)

-Eric Helgeson  
@nulleric [https://twitter.com/nulleric](https://twitter.com/nulleric)

On Wed, Aug 19, 2015 at 5:04 PM, Fouts, Chris [Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)  
wrote:

> I uploaded my latest linux\_role cookbook to my Berks API server, which is  
> just an organization on my Chef server accessed via port 26200. Hence I see
> 
> $ knife node show linux\_role
> 
> linux\_role 1.1.80 1.1.79 1.1.78 1.1.77 1.1.76 1.1.75 1.1.74  
> 1.1.72 1.1.71 1.1.70 1.1.69 1.1.68 1.1.67 1.1.66 1.1.65 1.1.64  
> 1.1.63
> 
> Now I want to upload v1.1.80 to my Chef server.
> 
> First I have to run berks install so I get the cookbook from my Berks API  
> server to my workstation correct? So I do
> 
> $ berks install  
> Installing linux\_role _(1.1.79)_ from _[http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)  
> [http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)_ ([chef\_server] _[https://chef-server.domain.com:443/organizations/berks-api](https://chef-server.domain.com:443/organizations/berks-api)  
> [https://chef-server.domain.com:443/organizations/berks-api](https://chef-server.domain.com:443/organizations/berks-api)_)
> 
> Why doesn’t it pick up v1.1.80? How can I make it pick up v1.1.80? I even  
> restarted the berks-api service to no avail.
> 
> Here’s my Berksfile
> 
> source "_[http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)  
> [http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)_"
> 
> metadata
> 
> Here’s the corresponding metadata.rb file
> 
> name “top\_level\_metadata”
> 
> depends ‘linux\_role’, ‘~\> 1.1.0’
> 
> I don’t necessarily want to change the version to ‘= 1.1.80’ because I  
> have other role cookbooks that depends on linux\_role, which means I’ll have  
> to update it’s version in their metadata.rb file, which means I have to  
> update their version. Other cookbooks in turn depend on them so…. the cycle  
> continues.
> 
> What am I missing?
> 
> Chris

---

<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:** [August 20, 2015, 2:45am UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822/3 "2015-08-20T02:45:24Z")

</div>

On Aug 19, 2015, at 3:04 PM, Fouts, Chris [Chris.Fouts@Sensus.com](mailto:Chris.Fouts@Sensus.com) wrote:

> I uploaded my latest linux\_role cookbook to my Berks API server, which is just an organization on my Chef server accessed via port 26200. Hence I see
> 
> $ knife node show linux\_role  
> linux\_role 1.1.80 1.1.79 1.1.78 1.1.77 1.1.76 1.1.75 1.1.74 1.1.72 1.1.71 1.1.70 1.1.69 1.1.68 1.1.67 1.1.66 1.1.65 1.1.64 1.1.63
> 
> Now I want to upload v1.1.80 to my Chef server.
> 
> First I have to run berks install so I get the cookbook from my Berks API server to my workstation correct? So I do
> 
> $ berks install  
> Installing linux\_role (1.1.79) from [http://chef-server.domain.com:26200](http://chef-server.domain.com:26200) ([chef\_server] [https://chef-server.domain.com:443/organizations/berks-api](https://chef-server.domain.com:443/organizations/berks-api))
> 
> Why doesn’t it pick up v1.1.80? How can I make it pick up v1.1.80? I even restarted the berks-api service to no avail.
> 
> Here’s my Berksfile  
> source "[http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)"  
> metadata  
> Here’s the corresponding metadata.rb file  
> name “top\_level\_metadata”  
> depends ‘linux\_role’, ‘~\> 1.1.0’  
> I don’t necessarily want to change the version to ‘= 1.1.80’ because I have other role cookbooks that depends on linux\_role, which means I’ll have to update it’s version in their metadata.rb file, which means I have to update their version. Other cookbooks in turn depend on them so…. the cycle continues.  
> What am I missing?  
> Chris

If there is a lock file that has the cookbook solved to 1.1.79 already and that still matches the constraint (which it does) you would have to do `berks update linux_role` to tell it to re-solve things.

--Noah

---

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [August 20, 2015, 2:25pm UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822/4 "2015-08-20T14:25:52Z")

</div>

On Thu, Aug 20, 2015 at 3:36 AM, Eric Helgeson [erichelgeson@gmail.com](mailto:erichelgeson@gmail.com)  
wrote:

> ~\> is pessimistic
> 
> From the docs[0]:
> 
> > ~\>(approximately greater than; also known as “_pessimistically_ _greater  
> > than_”, or “_pessimistic_”),
> 
> ​That means it will take the lowest version that fits the constraints  
> given.
> 
> ​If you're following semantec versioning you could set  
> depends 'linux\_role', '\>= 1.1.0'  
> ​which should pickup all versions in the 1.1.x range​

I'm pretty sure that is incorrect - "~\> 1.1.0" will match 1.1.x, while "\>=  
1.1.0" will match 1.1.x, 1.2.x, 99.100.x, etc.

The rubygems page on the subject[0] gives a fairly good treatment, but the  
same logic applies to cookbook dependencies.

Zac

[0] [Patterns - RubyGems Guides](http://guides.rubygems.org/patterns/#pessimistic-version-constraint)

---

<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:** [August 20, 2015, 3:15pm UTC](https://discourse.chef.io/t/why-is-berks-install-not-getting-latest-cookbook-version-from-berks-api-server/6822/5 "2015-08-20T15:15:22Z")

</div>

Thanks, I’ll try the “\>=” versioning. I am following semantic versioning

Chris

From: Eric Helgeson [[mailto:erichelgeson@gmail.com](mailto:erichelgeson@gmail.com)]  
Sent: Wednesday, August 19, 2015 10:37 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Why is berks install not getting latest cookbook version from Berks API server?

~\> is pessimistic

From the docs[0]:  
~\>(approximately greater than; also known as “pessimistically greater than”, or “pessimistic”),

​That means it will take the lowest version that fits the constraints given.

​If you’re following semantec versioning you could set  
depends ‘linux\_role’, '\>= 1.1.0’  
​which should pickup all versions in the 1.1.x range​

[0] ​https://docs.chef.io/config\_rb\_metadata.html

-Eric Helgeson  
@nulleric[https://twitter.com/nulleric](https://twitter.com/nulleric)

On Wed, Aug 19, 2015 at 5:04 PM, Fouts, Chris \<[Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)[mailto:Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)\> wrote:  
I uploaded my latest linux\_role cookbook to my Berks API server, which is just an organization on my Chef server accessed via port 26200. Hence I see

$ knife node show linux\_role  
linux\_role 1.1.80 1.1.79 1.1.78 1.1.77 1.1.76 1.1.75 1.1.74 1.1.72 1.1.71 1.1.70 1.1.69 1.1.68 1.1.67 1.1.66 1.1.65 1.1.64 1.1.63

Now I want to upload v1.1.80 to my Chef server.

First I have to run berks install so I get the cookbook from my Berks API server to my workstation correct? So I do

$ berks install  
Installing linux\_role (1.1.79) from [http://chef-server.domain.com:26200](http://chef-server.domain.com:26200) ([chef\_server] [https://chef-server.domain.com:443/organizations/berks-api](https://chef-server.domain.com:443/organizations/berks-api))

Why doesn’t it pick up v1.1.80? How can I make it pick up v1.1.80? I even restarted the berks-api service to no avail.

Here’s my Berksfile  
source "[http://chef-server.domain.com:26200](http://chef-server.domain.com:26200)"  
metadata  
Here’s the corresponding metadata.rb file  
name “top\_level\_metadata”  
depends ‘linux\_role’, ‘~\> 1.1.0’  
I don’t necessarily want to change the version to ‘= 1.1.80’ because I have other role cookbooks that depends on linux\_role, which means I’ll have to update it’s version in their metadata.rb file, which means I have to update their version. Other cookbooks in turn depend on them so…. the cycle continues.  
What am I missing?  
Chris
