On Apr 13, 4:08 am, Guillaume Rousse <[email protected]> wrote:
> Hello list.
>
> I'd like to implement a basic 'onlyif' property, as existing in 'exec'
> type, to 'service' type. Rather than patching the original puppet code,
> I think I could use the custom type mechanism, and implement my own
> 'conditional_service' type. However, in order to keep the benefit of
> existing providers, I think renaming the type isn't the best solution.
>
> So, would it possible to either inherit the original type definition,
> and just add the new property, or distributing a modified type copy as
> part of a module would also replace original type definition for this
> module ?
No.
That is, you *can* subclass the built-in type and add a parameter, but
you cannot expect the existing type's providers to work with your
subclass. In fact, it is likely that the new behavior you want needs
to be in the provider(s) anyway.
> BTW, the exact intent is to allow to test the configuration file syntax
> before reloading a service, and avoid reloading it with an invalid
> state. Something as:
>
> file { "/etc/openldap/slapd.conf":
> content => template("slapd.conf.erb"),
> notify => Service["slapd"]
>
> }
>
> service { "slapd":
> ensure => "running",
> onlyif => "/usr/sbin/slaptest"}
I'm with Craig that it would be best to rely on the initscript to
perform the test.
Moreover, I don't find the current behavior that bad. Is it better to
continue running the service with an out-of-date configuration? Is it
better to delay discovering the problem until the machine is
restarted, or until you or some other admin tries to restart the
service manually? If it were my server, the answers to both questions
would be "no".
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.