rackerlabs / fastfood

DEPRECATED
Apache License 2.0
1 stars 7 forks source link

Generated Berksfile/metadata.rb should merge dependencies #33

Open brint opened 9 years ago

brint commented 9 years ago

Referencing this code. Fastfood should merge dependencies when building the Berksfile.

Example: Template 1

{
  "id": "redis",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": {},
  }
}

Template 2

{
  "id": "apache",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": {},
  }
}

The Berksfile should only contain one entry for rackspace_iptables. If versions do not match, it should merge them:

Example: Template 1

{
  "id": "redis",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": { 
      "constraint": ">= 1.0" 
    }
  }
}

Template 2

{
  "id": "apache",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": { 
      "constraint": ">= 2.0" 
    }
  }
}

This should add an entry to the Berksfile of rackspace_iptables, '>= 2.0'.

Finally, if the constraints do not match, fastfood should error since cookbook dependencies cannot be resolved. Example:

Template 1

{
  "id": "redis",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": { 
      "constraint": "~> 1.0" 
    }
  }
}

Template 2

{
  "id": "apache",
  "api": 1,
  "default_stencil": "single",
  "dependencies": {
    "rackspace_iptables": { 
      "constraint": ">= 2.0" 
    }
  }
}
jujugrrr commented 9 years ago

@jarosser06 . It seems dependencies are set on the stencil_set, it is possible to set them per stencil? Not sure what is the scope of a stencil_set, but I guess you don't have to use all the recipes from a stencil_set, therefore you only need to get the dependencies for the stencil you use, not the whole stencil_set.

It's not a problem yet as stencil_set are small, but the more people write them the more dependencies we will need.

jarosser06 commented 9 years ago

@jujugrrr Yes dependencies can be set per stencil as well.

jujugrrr commented 9 years ago

@jujugrrr Yes dependencies can be set per stencil as well.

Thanks for the update!