I've written a simple custom service provider for monit that inherits from
the debian provider. Since this is running on debian systems, I want to use
the debian "enable" to enable/disable running at boot, but I want monit to
manage the running service rather than puppet.

Puppet::Type.type(:service).provide :monitdummy, :parent => :debian do
>   desc <<-'EOT'
> Dummy provider for monit; always reports status as "running" so puppet
> doesn't manage the running state
>   EOT
>
>   confine :exists => "/usr/bin/monit"
>
>   def startcmd
>     [ "/bin/true" ]
>   end
>   def stopcmd
>     [ "/bin/true" ]
>   end
>   def restartcmd
>     [ "/bin/true" ]
>   end
>   def statuscmd
>     [ "/bin/true" ]
>   end
> end
>

It works for what I need. My problem is that this has now become the
default provider on my system, according to facter:

# facter -p | grep service
> service_provider => monitdummy


I've tried adding a call to "defaultfor" like this:

defaultfor :operatingsystem => 'none'


...but that doesn't have any effect, I guess because it's inheriting the
defaultfor from the debian provider and there can be multiple?

Looking at the code in
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider.rb,
there is the function "self.specificity" that picks the provider with the
most ancestors, so I guess that's why my provider gets picked over debian.

I realize I could set debian as the default provider with "Service {
provider => 'debian' }" in a high-level manifest, but that seems less than
ideal since it short-circuits puppet's provider selection-- what I'd really
like would be for a way to ensure that my custom provider is never the
default.

Is there any way to do this?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAEo6%3DKYU449ig7VmDYiLYkhpjDz9-jMP_aXx7isSyQkpOxiRew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to