In regard to: [Puppet Users] Re: selecting a command in a provider based on...:



On Friday, April 11, 2014 7:15:05 PM UTC-5, Tim Mooney wrote:


Hi All!

The tl;dr version:

Can anyone point me at an example of an existing provider that selects
a particular command based not on a facter fact or whether a particular
path exists, but instead on a variable from a puppet class?



No, and that's a poor idea.  Providers should not have visibility into or
dependency on the class declaring the resource provided for.

If your provider is for a custom type, however, then it seems to me that
the natural approach would be to add a parameter (not a property) to the
type.  Providers can easily access the parameter values of a resource
instance; in fact, that's the entire purpose of parameters that are not
properties.

If you are writing custom providers for built-in types, however, then the
best I can come up with is to write different flavors of the provider (with
different names) to cover the specific cases you care about.

Thanks John!  That idea occurred to me over the weekend and you've
confirmed that it's a much better way to go.

Much appreciated,

Tim
--
Tim Mooney                                             tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, Quentin Burdick Building                  701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/alpine.SOC.2.11.1404141351490.17447%40dogbert.cc.ndsu.NoDak.edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to