Metadata "supports" setting

How exactly is the “supports” setting used? I ask because I have a Windows
only cookbook with the following declaration in the metadata.rb:

supports “windows”

This cookbook is used by an LWRP in another cookbook that supports both Windows
and RedHat:

supports "windows"
supports “redhat”

This cookbook is used by another, which is in turn used by another, … on and
on.

When using the 10.18.2 client and a run list on Linux that indirectly uses the
Windows only cookbook, the Windows only cookbook is downloaded and its
attributes evaluated.

I found this out because the Windows only cookbook contains some custom audit
information that is incomplete because it isn’t applicable on Linux. I would
prefer for this cookbook to not have it attributes evaluated at all.

Is there any way to prevent Windows only cookbooks from having their attributes
evaluated on Linux?

There's an open ticket for implementing platform-specific loading of
cookbooks for this exact reason.

--
~~ StormeRider ~~

"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS

On Fri, Sep 20, 2013 at 1:24 PM, markmaxey@verizon.net wrote:

How exactly is the "supports" setting used? I ask because I have a Windows
only cookbook with the following declaration in the metadata.rb:

supports "windows"

This cookbook is used by an LWRP in another cookbook that supports both
Windows
and RedHat:

supports "windows"
supports "redhat"

This cookbook is used by another, which is in turn used by another, ... on
and
on.

When using the 10.18.2 client and a run list on Linux that indirectly uses
the
Windows only cookbook, the Windows only cookbook is downloaded and its
attributes evaluated.

I found this out because the Windows only cookbook contains some custom
audit
information that is incomplete because it isn't applicable on Linux. I
would
prefer for this cookbook to not have it attributes evaluated at all.

Is there any way to prevent Windows only cookbooks from having their
attributes
evaluated on Linux?

TL;DR, it isn't used at all and as Morgan there's a ticket:
https://tickets.opscode.com/browse/CHEF-3871

Longer form:

There were several components of metadata that were added, but had
nothing functionally implemented. Some of them are used by user
interfaces (e.g., the Chef community site, RightScale's user
interface/control panel). Supports has no enforcement in Chef itself
built in. However, if you want to use this metadata to, for example,
not run a recipe when a platform isn't specifically supported, I wrote
a cookbook as a proof of concept:

http://community.opscode.com/cookbooks/enforce_supported_platform

(It's may be important to note that while I work for Opscode, Opscode
doesn't support this cookbook :-).)

Primarily the supports field in metadata is used by the maintainer to
indicate which platforms the cookbook will actually work on, but even
that is nuanced. Did they build test kitchen tests? Just run the
default recipe? Are paid to support it (rare)? The nuances are rife,
and not well defined. More discussion on the CHEF-3871 ticket is
helpful to shape how 'supports' is defined and to what scope.

Cheers,
Joshua

On Fri, Sep 20, 2013 at 2:24 PM, markmaxey@verizon.net wrote:

How exactly is the "supports" setting used? I ask because I have a Windows
only cookbook with the following declaration in the metadata.rb:

supports "windows"

This cookbook is used by an LWRP in another cookbook that supports both Windows
and RedHat:

supports "windows"
supports "redhat"

This cookbook is used by another, which is in turn used by another, ... on and
on.

When using the 10.18.2 client and a run list on Linux that indirectly uses the
Windows only cookbook, the Windows only cookbook is downloaded and its
attributes evaluated.

I found this out because the Windows only cookbook contains some custom audit
information that is incomplete because it isn't applicable on Linux. I would
prefer for this cookbook to not have it attributes evaluated at all.

Is there any way to prevent Windows only cookbooks from having their attributes
evaluated on Linux?

--
Joshua Timberman, Opscode, Inc.

1 Like