I have the following Berksfile in my app/ directory:
source "https://supermarket.chef.io"
cookbook "apt", "~> 3.0.0"
cookbook "nodejs", "~> 2.2"
When I run berks install (version 4.3.3), I get:
Resolving cookbook dependencies...
Fetching cookbook index from https://supermarket.chef.io...
Using apt (3.0.0)
...
My app directory contains a Berksfile.lock that contains the following line
apt (3.0.0)
In my initial Berksfile I remove the cookbook apt line (line 2). I expect berks to use my Berksfile.lock. But instead, when I run berks install again I get:
Resolving cookbook dependencies...
Fetching cookbook index from https://supermarket.chef.io...
Using apt (4.0.0)
And my Berksfile.lock gets updated with the new apt version.
Is this the expected behaviour? I would expect this behaviour with the berks update command...
Do not specify version constraints in the
Berksfile, but usemetadata.rbinstead. This also ensures that the correct version is used when runningchef-client.