On Mar 18, 2009, at 1:23 PM, Jim Pirzyk wrote:

> I have been working on full feature syslog type and providers.  I
> have a few questions about how to do things.
>
> 1) How do I have a type 'implement' functionality from another type.
>
> For example, I have these 2 types:
>
> file {"/var/log/ipfw.log":
>       ensure => present,
>       mode => 600,
>       owner => root,
>       group => wheel,
> }
> syslog { "/var/log/ipfw.log":
>       selector => 'security.info'',
>       ensure => present,
>       notify => [ Service[syslog] ]
>       mode => 600,
>       owner => root,
>       group => wheel,
> }
>
> I'd like not to have the first file{} type and have the provider
> 'touch' the file if it does not exist.

You could have the syslog type generate the file resource:

def generate
   Puppet::Type.type(:file).create(:path => self[:name], :mode  
=> ....) unless catalog.resource(:file, self[:name])
end

Something like that, anyway.

>
> 2) Is there an 'autonotify' feature like there is autorequire?  Seems
> like I should be able to have it notify the syslog service every time
> I update the syslog.conf file.

There is not; I've never had anyone ask for it.  I'd accept a patch  
for it, but you can hack it in the initialize method in the meantime.   
Just do something like:

   def initialize(*args)
     super
     self[:notify] = [:service, "syslog"]
end

Yes, hackish, but that's what you get for being special. :)

OTOH, if you're generating the file as above, then include the  
'notify' value in the arguments to it.

-- 
I object to doing things that computers can do. --Olin Shivers
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to