On Tuesday, July 24, 2012 4:45:11 AM UTC-5, olli...@googlemail.com wrote:
>
> Hello,
>  
> On some machines being managed by Puppet I would like to perform targetted 
> audit runs with "puppet -t --noop --tags audit"
>  
> For better or for worse I am trying to do this with a separate module 
> "audit" rather than add the audit => to the resources and use inheritence.
>  
> i.e.
> class audit::resolver inherits resolver::config {
>   notify{"Running audit on $resolver::params::config_file": }
>   File['resolv.conf'] {
>     audit +> all
>   }
> }
> The $resolver::params::config sets the path for the resource and I just 
> want to audit it rather than change amend it but it doesn't seem to work.
>  
> Is this possible or not really ? Or is there a fundamentally better way of 
> doing it ?
>  
>

"Doesn't seem to work" isn't very helpful.  Does Puppet emit any relevant 
messages?  Did you try running with --debug?

Your general idea sounds feasible.  I see two specific problems in the 
example code you posted, however:

   1. Is the title of the File resource you want to override really 
   'resolv.conf'?  I mean, it could be if you specified the full path via the 
   'path' parameter in the original declaration, but it didn't sound like 
   that's what you had done.
   2. You do not want plussignment in this case.  You want to set the value 
   of the 'audit' parameter to the scalar value 'all', regardless of what 
   might have been declared in the parent class.  Use the regular assignment 
   operator for that.

So what you want might be:

class audit::resolver inherits resolver::config {
  notify{"Running audit on $resolver::params::config_file": }
  File["$resolver::params::config_file"] {
    audit => all
  }
}

That also assumes, of course, that the File whose declaration you are 
trying to override is in fact declared in class resolver::config (or an 
ancestor).


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/yZAyKFfRsTIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to