On Wednesday, December 18, 2013 2:23:52 AM UTC-6, Andy Spiegl wrote:
>
> On 2013-12-17, 16:31, Ben Ford wrote: 
>
> > If you override something in a recursive directory, you're 
> > overriding everything. 
> I see, that makes sense. 
>
> > If you add source => 'puppet:///modules/nagios/var_lib_nagios/plugins' 
> then 
> > I suspect you'll get what you want. 
> You are right, that did it.  Thanks! 
>
> > I should also point out that this is unnecessary, as Puppet will 
> > automatically promote read permissions to read & execute permissions 
> > for directories. 
> No, not exactly as the mode definition is meant for the files in the 
> subdirectory.  There are executables in "bin" and "plugins". 
>
> So, what would be a better way of changing the mode of some files 
> within a directory resource with "recurse" activated?  Adding "source" 
> for all of them seems awkward... 
>
>
 
Sorry, Puppet does not do the kind of resource property merging that you 
seem to want.  As Ben wrote, when you have an explicit declaration of a 
File resource that otherwise would be managed via a recursive directory 
resource, the explicit declaration is the only one considered.  Consider 
that the sources of the /var/lib/nagios/{plugins,bin} directories needn't 
actually appear on the masters as subdirectories of the source for 
/var/lib/nagios -- expressing the sources explicitly is not awkward, it's 
appropriate.

There are a few things you could do to make this more palatable.  For 
example, you can keep the needed manifest code DRY and clear by using a 
variable to specify the sources:

  $nagios_source = 'puppet:///modules/nagios/var_lib_nagios'
  file { '/var/lib/nagios': 
        ensure    => directory, 
        source    => ${nagios_source}, 
        recurse   => true, 
        mode      => '0664', 
  } 
  file { '/var/lib/nagios/plugins': 
        ensure    => directory, 
        source    => "${nagios_source}/plugins", 
        recurse   => true, 
        mode      => '0775', 
  } 
  file { '/var/lib/nagios/bin': 
        ensure    => directory, 
        source    => "${nagios_source}/bin", 
        recurse   => true, 
        mode      => '0775', 
  } 


Alternatively, packages are sometimes better than recursive File resources 
for managing directory trees.

Or you could abandon managing file modes for the whole /var/lib/nagios tree 
via File resources, and do it instead via an Exec.


John

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/96a5ef72-2784-42ef-890f-f1f52c12fe66%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to