of custom types and providers

95 views
Skip to first unread message

Oren Marmor

unread,
May 31, 2012, 12:14:37 PM5/31/12
to Puppet Users
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.

Oren.

jcbollinger

unread,
Jun 1, 2012, 9:58:37 AM6/1/12
to Puppet Users
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
Reply all
Reply to author
Forward
0 new messages