On Mar 31, 4:45 pm, Forrie <for...@gmail.com> wrote:
> This actually seems to work better:
>
>         file { "/usr/local/nagios":
>                         ensure => directory,
>                         owner  => 'root',
>                         group  => 'root',
>                         mode   => 655,
>         }
>
>         file { "/usr/local/nagios/libexec":
>                         require => File['/usr/local/nagios'],
>                         ensure => directory,
>                         owner  => 'root',
>                         group  => 'root',
>                         mode   => 655,
>         }
>
> It's more verbose, but it works.   I would still like to see something
> in puppet that does some recursive directory creation/management.

Puppet has it in the top-down form governed by the File type's
"recurse" parameter, rather than in a bottom-up form analogous to
"mkdir -p".  I think that's consistent: if you don't tell Puppet what
properties the ancestor directories it may need to make should have,
then Puppet can neither be sure to get it right nor verify on
subsequent runs.  To tell Puppet what the properties should be, you
must write resource declarations for the ancestor directories.

In addition, the reason your other version did not work appears at
least partly to be that you did not specify a value for the "ensure"
property (or any other) for File "/usr/local/nagios".  The
<title><colon> <semicolon> declares a resource with an empty property
list (following the colon and terminated by the semicolon).  My
apologies that I did not notice before.  The resource reference does
not fully document what a File means in that case, but it would be
surprising if it meant that a directory of the specified name should
be present.  My guess would be that it's a no-op.

This may be what you were originally looking for:

    file {  [ "/usr/local/nagios", "/usr/local/nagios/libexec" ]:
                owner    => 'root',
                mode     => 655,
                group    => 'root',
                ensure   => directory,
    }

You could also use an array-valued variable to specify the names
instead of an array literal.  That declares both of the listed
directories, assigning the same property values to them.  These are
general features of Puppet resource declarations, in no way specific
to the File type.

Note also that for cases like this one, an explicit "require"
parameter is not needed; Puppet can and does automatically figure out
and use file dependencies such as the one between those two
directories.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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