Why to add transitional dependencies to Berksfile?

506 Views Asked by At

I'm developing a cookbook (my_cookbook) that has dependencies with another cookbook (another_cookbook) that has dependencies with another cookbook (another_cookbook2). Why do I need to specify transitional dependencies in my_cookbook Berksfile (means to add the another_cookbook2 dependency to Berskfile)? If the dependency with another_cookbook2 was already specified in the another_cookbook Berksfile?

$ berks install
Resolving cookbook dependencies...
...
Unable to satisfy constraints on package another_cookbook2, which does not exist, due to solution constraint (another_cookbook = 0.0.1). Solution constraints that may result in a constraint on another_cookbook2: [(another_cookbook = 0.0.1) -> (another_cookbook2 >= 0.0.0)]
Missing artifacts: another_cookbook2
...

I'm trying to do this before uploading my cookbook to a Chef server.

1

There are 1 best solutions below

0
On

You don't.
If you share your Berskfiles, we can show you what's up.
Dependencies are listed in the metadata.rb file, not the Berksfile. The Berksfile just tells Berks where to find those dependencies.

If you don't have a decent Berks API endpoint in your berksfile, like supermarket.chef.io, then you may have to list location for the dependent cookbooks.

Unlike metadata.rb, berksfiles are not built recursively, and thus the Berksfile in a dependent cookbook will not be used.