I've already tried it, and I get error below. In this example, I have an arqiva_rni_dev environment cookbook, which depends on linux_role role cookbook, and itself depends on common-log cookbook. I have ALL the correct version in my Git repo.
Here's my Berksfile
source "https://supermarket.chef.io"
metadata
Community cookbooks
cookbook 'chef-client'
cookbook 'powershell'
cookbook 'push-jobs'
Company cookbooks
cookbook 'linux_role', git: 'git@git-server:arqchefcookbooks/linux_role.git'
My metadata.rb is
name 'arqiva_rni_dev'
(snip)
depends 'linux_role', '1.0.2'
My linux_role/metadata.rb has
depends 'common-log', '~> 0.1.0'
.....
$ berks install
Resolving cookbook dependencies...
Fetching 'arqiva_rni_dev' from source at .
Fetching 'linux_role' from git@git-server:arqchefcookbooks/linux_role.git (at master)
Fetching cookbook index from https://supermarket.chef.io...
Unable to satisfy constraints on package common-log, which does not exist, due to solution constraint (arqiva_rni_dev = 0.1.0). Solution constraints that may result in a constraint on common-log: [(arqiva_rni_dev = 0.1.0) -> (linux_role = 1.0.2) -> (common-log = 0.1.0)], [(linux_role = 1.0.2) -> (common-log = 0.1.0)]
Missing artifacts: common-log
Demand that cannot be met: (arqiva_rni_dev = 0.1.0)
Unable to find a solution for demands: arqiva_rni_dev (0.1.0), chef-client (>= 0.0.0), linux_role (1.0.2), powershell (>= 0.0.0), push-jobs (>= 0.0.0)
I can get rid of the error by including the common-log cookbook in my top-level Berksfile, but you're saying I should NOT have to do this.
Chris
-----Original Message-----
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 4:05 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How to setup Berkshelf to install ALL cookooks "recuresively', with only role cookbooks in it?
Yep, you should expect this to work. Everything else would be a big surprise to me at least...
Have you tried it already, or are you just elaborating how to set things up?
Cheers, Torben
On Tue, Apr 7, 2015 at 9:44 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:
Note, these are NOT supermarket cookbooks, but rather our company
cookbooks on our own git server, which is not configured like a super market.
Knowing this, should I still expect this to work?
Chris
From: Torben Knerr [mailto:mail@tknerr.de]
Sent: Tuesday, April 07, 2015 3:13 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How to setup Berkshelf to install ALL cookooks
"recuresively', with only role cookbooks in it?
Hey Chris,
Berkshelf should actually resolve the dependencies transitively.
In your top-level Berksfile you should only need the role cookbooks.
Once you run a 'berks install' there you should get a Berksfile.lock
which locks the whole dependency graph, including the transitive ones.
Do you observe something different?
HTH,
Torben
Am 07.04.2015 19:23 schrieb "Fouts, Chris" Chris.Fouts@sensus.com:
I want to setup an environment cookbook Berksfile with nothing but
role cookbooks in it, and the role cookbooks themselves will then
aggregate the specific cookbooks they need. For example
myApp/Berksfile
cookbook ‘app1_role’, git: ‘git@git-server.domain.com:group/app1_role.git’
cookbook ‘app2_role’, git: ‘git@git-server.domain.com:group/app2_role.git’
myApp/metadata.rb
depends ‘app1_role’, ‘~> 1.0.0’
depends ‘app2_role’, ‘~> 1.0.0’
app1_role/metadata.rb
depends ‘cookbook1’, ‘= 1.0.0’
depends ‘cookbook2, ‘= 1.0.0’
app2_role/metadata.rb
depends ‘cookbook3’, ‘= 1.0.0’
depends ‘cookbook4, ‘= 1.0.0’
How can I set this up so I ONLY have the role cookbooks, but not the
individual cookbooks they need, in my environment cookbook’s
Berksfile, and when I do a berks install, it will auto-magically
install the cookbooks that my role cookbooks need? Currently, I also
have to include the cookbooks that my role cookbooks need in my environment Berksfile.
Make sense?
Chris