Choosing resource providers


#1

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


#2

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. (http://github.com/opscode/chef/blob/89a2609242a63d6bc85e0ddfed078319b4d4a81b/chef/lib/chef/platform.rb#L29
). 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


#3

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.
(http://github.com/opscode/chef/blob/89a2609242a63d6bc85e0ddfed078319b4d4a81b/chef/lib/chef/platform.rb#L29). 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


#4

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.
(http://github.com/opscode/chef/blob/89a2609242a63d6bc85e0ddfed078319b4d4a81b/chef/lib/chef/platform.rb#L29
). 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