opscode/chef — pull request #1305 by liseki (2014-03-17 19:05:06+00:00)
Title: [CHEF-3404] Allow dynamic resolving of resource providers

This is a rough sketch to demonstrate approach. This approach relies on each provider specifying which resource(s) it implements and on which platforms. This information is currently available in the provider mapping. Each provider also has to indicate whether or not it is enabled; this is true by default. So you could have 2 or more providers for a single resource on a given platform but not all of them may be enabled on the node.

The resolver picks up the supported providers and allows the resource to evaluate them. By default this is just picking the first one. On CHEF-3404 this might allow the opportunity to throw an exception if more than one provider is enabled.

At the moment I have implemented this provider interface for FreeBSD providers. With that we could remove the FreeBSD entry in provider mapping. For all FreeBSD providers to resolve dynamically we would have to specify ```:on_platforms => :all``` for all the OS-agnostic providers (file, directory, link etc).