On May 31, 11:14 am, Oren Marmor <oren.mar...@gmail.com>
wrote:> Hi all.
> i am trying to define some types and providers and was wondering if
> someone could explain the process of which provider is chosen to
> implement the type.
> say i have a type for web application and two providers - tomcat and
> jetty.
> i would like to choose which application to use according to a value
> of a property (which i have) and set a default provider of tomcat.
> i tried using resource[:provider] = :tomcat in a case matching the
> patterns i want but i get the following error when running couple of
> consecutive times:
> err: Could not run Puppet configuration client: Parameter source
> failed: Invalid parameter provider at /etc/puppet/modules/test/
> manifests/init.pp:10
>
> specific solution and explanation about how this process works would
> be appreciated.
You should read Puppetlabs docs on type and provider development if
you have not done so already. In particular, read this:
http://docs.puppetlabs.com/guides/provider_development.html.
The standard mechanisms for choosing "suitable" and default providers
involve the using the ''commands'', ''confine'',
and / or ''defaultfor''
functions in your *provider''s* code. The first two of those allow you
to determine whether a particular provider will work on the node at
all (is "suitable"), and the last allows you to declare your provider
as the default for a specified (non-empty) fact pattern. Those
provide no means to declare a universal default, but you can declare a
default for a fact pattern that you are confident will match all your
nodes. For example, perhaps this would work:
defaultfor :kernel => "Linux"
or maybe
defaultfor :domain => "mydomain.com"
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.