I still don't understand why you want to do this. Why embed the
functionality of the service type into another type? Just use a service
resource. I think you're going about this in entirely the wrong way.
Regards
James Turnbull
--
Author of:
* Pro Linux Systems Administration
(http://www.amazon.com/gp/product/1430219122/)
* Pulling Strings with Puppet
(http://www.amazon.com/gp/product/1590599780/)
* Pro Nagios 2.0
(http://www.amazon.com/gp/product/1590596099/)
* Hardening Linux
(http://www.amazon.com/gp/product/1590594444/)
> We need it to be a service provider and we want to put all the code in
> one place as demonstrated in my requirement code snippet.
> If you have a better idea in mind, please do post it... ( Posting a
> sample site.pp snippet which is what I am looking for.. it'd be
> *terrific* if you can do that )
>
I obviously don't get why it needs to be a service provider.
What's wrong with:
monit { "blah":
start => "/opt/thingie/start-stop-thingie start",
stop => "/opt/thingie/start-stop-thingie stop",
pidfile => "/var/thingie/pidfile.pid",
monitextra => "group assorted_thingies\nif memory > 120 Mb then restart",
require => Package["thingie"],
}
service { "monit":
running => true,
subscribe => Monit[blah]
Obviously it doesn't need to be. However, we are choosing a bit of complexity in the back end in exchange for a simplified/consolidated puppet DSL code block.
On May 16, 2009 10:50 AM, "James Turnbull" <ja...@lovedthanlost.net> wrote:On Sat, 16 May 2009 07:06:18 -0700 (PDT), Manish Chakravarty <manis...@gmail.com> wrote: > We ...
I obviously don't get why it needs to be a service provider.
What's wrong with:
monit { "blah":
start => "/opt/thingie/start-stop-thingie start", stop => "/opt/thingie/start-stop-thin...
service { "monit":
running => true,
subscribe => Monit[blah]
} Regards James Turnbull -- Author of: * Pro Linux Systems Administration (http://www.amazon.com...
> Obviously it doesn't need to be. However, we are choosing a bit of
> complexity in the back end in exchange for a simplified/consolidated puppet
> DSL code block.
you could combine these two afterwards with a simple define. So at the
end you're still only calling one define which is calling 2 providers.
cheers pete
>
> James,
>
> Let me explain what Manish is trying to do. Basically he has been
> asked to write a service provider for monit. In this case we speced it
> out so that the service provider can enable and disable the service,
> in addition to just start/stop/restart. (Other service providers
> provide this functionality)
>
> Unfortunately two things complicate this:
> 1) Monit doesn't have precanned service definitions that we can just
> activate or symlink to. (Thus the need to generate configs)
> 2) We can't inherit from both base.rb and parsefile.rb, so we are
> taking this approach of using a wrapper class
But wouldn't the monit service configurations be normal files,
essentially, rather than collections of records?
ParsedFile is only useful if a file is a list of records, like /etc/
passwd, /etc/hosts, things like that. If your file is essentially
just a shell script, then using a simpler system -- such as requiring
the user to use template(...) in the language, or specifying a source
-- is much better.
Probably the best approach is to use generate() to create a file
instance with its source set appropriately for the service, and then
specify that the service requires the file.
This is still complicated, a bit, but much better than what was
otherwise proposed.
--
The cure for writer's cramp is writer's block.
-- Inigo DeLeon
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com