[chef] Re: Re: Cookbook dependencies doc


Chronological Thread 
  • From: Silviu Dicu < >
  • To: " " < >
  • Subject: [chef] Re: Re: Cookbook dependencies doc
  • Date: Thu, 27 Feb 2014 19:17:48 -0500

Hi,

I was looking for a document that explains what is the merging order of the dependencies and who will win in the end 
Take a situation like this

Node run config
{
  "name": "test-constraints",
  "chef_environment": "test",
  "normal": {
  },
  "run_list": [
    "recipe[a]"
  ]
}

$ grep depends  cookbooks/a/metadata.rb
depends "b"
depends "tech", "= 0.3.0"

$ tail -1 cookbooks/a/recipes/default.rb
include_recipe "b"

$ grep depends cookbooks/b/metadata.rb
depends "tech", "= 0.1.0"

$ tail -1  cookbooks/b/recipes/default.rb
include_recipe "tech"

$ grep tech environments/test.json
    "tech": "= 0.2.0"


This runs w/o problems.
But if I change environment to = 0.1.0 will do this

[2014-02-28T00:07:36+00:00] INFO: HTTP Request Returned 412 Precondition Failed: {"message"=>"Unable to solve constraints, the following solutions were attempted \n\n    Unable to satisfy goal constraint a due to constraint on tech\n        (a = 0.1.0) -> (tech = 0.2.0)\n    Unable to satisfy goal constraint a due to constraints on tech\n        (a = 0.2.0) -> (tech = 0.3.0)\n        (a = 0.2.0) -> (b = 0.1.0) -> (tech = 0.1.0)\n", "unsatisfiable_run_list_item"=>["a"], "non_existent_cookbooks"=>[], "most_constrained_cookbooks"=>["(tech = 0.2.0)"]}

If I change environment to = 0.3.0

[2014-02-28T00:13:08+00:00] INFO: HTTP Request Returned 412 Precondition Failed: {"message"=>"Unable to solve constraints, the following solutions were attempted \n\n    Unable to satisfy goal constraint a due to constraint on tech\n        (a = 0.1.0) -> (tech = 0.2.0)\n    Unable to satisfy goal constraint a due to constraints on tech\n        (a = 0.2.0) -> (tech = 0.3.0)\n        (a = 0.2.0) -> (b = 0.1.0) -> (tech = 0.1.0)\n", "unsatisfiable_run_list_item"=>["a"], "non_existent_cookbooks"=>[], "most_constrained_cookbooks"=>["(tech = 0.2.0)"]}

$ knife cookbook show tech
tech   0.3.0  0.2.0  0.1.0

thanks!

-silviu



Best,
-M


On Thu, Feb 27, 2014 at 1:32 PM, Silviu Dicu < " target="_blank"> > wrote:
Hi,

Could somebody point to a document describing how the cookbook dependencies are calculated ?

I found for attributes http://docs.opscode.com/chef_overview_attributes.html but not sure if apply for cookbook version constraints.


thanks!

- silviu





Archive powered by MHonArc 2.6.16.

§