Choosing resource providers

Hello!

Is there a way to configure the provider for a resource (i.e. the
package resource) for a whole node or at least the whole recipe? The
provider can be choosen for each resource individually, but I would like
to configure this only once so i don’t have to repeat myself again and
again.

Regards,
Claus

Hi,

On 22/08/2009, at 10:27 PM, Claus Divossen wrote:

Hello!

Is there a way to configure the provider for a resource (i.e. the
package resource) for a whole node or at least the whole recipe? The
provider can be choosen for each resource individually, but I would
like
to configure this only once so i don't have to repeat myself again and
again.

You're able to leverage a Library (http://wiki.opscode.com/display/chef/Libraries
) to adjust our internal platform, platform version => provider
mapping. (chef/chef/lib/chef/platform.rb at 89a2609242a63d6bc85e0ddfed078319b4d4a81b · chef/chef · GitHub
). However be aware that once this is set, it will be valid for that
entire 'run', or indefinitely while daemonized.

E.g.:

Chef::Platform.platforms[:default].merge! :deploy =>
Chef::Provider::Deploy, :gem_package =>
Chef::Provider::package::Rubygems

Hope this helps,

AJ Christensen, Software Engineer
Opscode, Inc.
E: aj@opscode.com

Hello!

Is there a way to configure the provider for a resource

You're able to leverage a Library
(http://wiki.opscode.com/display/chef/Libraries) to adjust our
internal platform, platform version => provider mapping.
(chef/chef/lib/chef/platform.rb at 89a2609242a63d6bc85e0ddfed078319b4d4a81b · chef/chef · GitHub). However be aware that once this is set, it will be valid for that entire 'run', or indefinitely while daemonized.

Oh, that's fine. In fact, if I could I would like to change the default
for my whole site, to make all the linux nodes use yum.

Chef::Platform.platforms[:default].merge! :deploy =>
Chef::Provider::Deploy, :gem_package =>
Chef::Provider::package::Rubygems

":deploy"? Did you mean ":package"? Like:

Chef::Platform.platforms[:default].merge! :package =>
Chef::Provider::package::Yum

Best Regards,
Claus

Hi,

On 23/08/2009, at 1:32 AM, Claus Divossen wrote:

Hello!

Is there a way to configure the provider for a resource

You're able to leverage a Library
(http://wiki.opscode.com/display/chef/Libraries) to adjust our
internal platform, platform version => provider mapping.
(chef/chef/lib/chef/platform.rb at 89a2609242a63d6bc85e0ddfed078319b4d4a81b · chef/chef · GitHub
). However be aware that once this is set, it will be valid for
that entire 'run', or indefinitely while daemonized.

Oh, that's fine. In fact, if I could I would like to change the
default
for my whole site, to make all the linux nodes use yum.

Chef::Platform.platforms[:default].merge! :deploy =>
Chef::Provider::Deploy, :gem_package =>
Chef::Provider::package::Rubygems

":deploy"? Did you mean ":package"? Like:

Chef::Platform.platforms[:default].merge! :package =>
Chef::Provider::package::Yum

Sorry about that, I sure did. Pasted example from the 'deploy'
resource :wink:

--
AJ Christensen, Software Engineer
Opscode, Inc.
E: aj@opscode.com