[chef] platform specific config in a cookbook's metadata.rb?


Chronological Thread 
  • From: "joe.nuspl" < >
  • To: Chef Users < >
  • Subject: [chef] platform specific config in a cookbook's metadata.rb?
  • Date: Mon, 14 Oct 2013 14:26:31 -0700

Taking the erlang cookbook as an example:

depends           "apt", ">= 1.7.0"
depends           "yum", ">= 0.5.0"
depends           "build-essential"

We're a CentOS-only shop so it seems silly to have to load the apt cookbook 
(and maintain the version forced march) when it will never be used.

I was thinking something like:

case
when platform_family?("debian")
  depends         "apt", ">= 1.7.0"
  suggests        "build-essential"
when platform_family?("rhel")
  depends         "yum", ">= 0.5.0"
  suggests        "build-essential"
else
  depends         "build-essential"
end

This does not work.  I suppose these could be "suggest" and let the 
include_recipe fail.  Is there an "official" pattern for this?

Thanks.

        Joe


Archive powered by MHonArc 2.6.16.

§