> file { "/home/jeff/src/my/dir/path":
> path => "/home/jeff/src/my/dir/path",
> mode => 0755,
> owner => jeff,
> group => jeff,
> ensure => directory,
> recurse => true,
> }
>
> But puppet complains the parent directory doesn't exist. How can I do
> the equivalent of
>
> mkdir -p /home/jeff/src/my/dir/path
with the file resource only with:
file { [ '/home/jeff/src/', '/home/jeff/src/my/',
'/home/jeff/src/my/dir', "/home/jeff/src/my/dir/path" :
[...]
}
this is due to various reasons. the main reason for that is imho as
puppet has to now about the things its manages. so to which point it
should go back? and what then?
recurse is only true from the managing point on deeper into the
filesystem. (usefull for purging or source synching)
another thing would be:
exec{'mkdir -p /home/jeff/src/my/dir/path':
unless => 'test -d /home/jeff/src/my/dir/path',
}
which is indeed ugly, but quick.
greets pete
Hi all, I'd like to add a several directories and I can't seem to do it with a single "file" directive.
Say /home/jeff exists and I want to add /home/jeff/src/my/dir/path
I tried:
file { "/home/jeff/src/my/dir/path":
path => "/home/jeff/src/my/dir/path",
mode => 0755,
owner => jeff,
group => jeff,
ensure => directory,
recurse => true,
}
But puppet complains the parent directory doesn't exist. How can I do
the equivalent of
mkdir -p /home/jeff/src/my/dir/path
TIA, Jeff
TIA, Jeff
What is now proved was once only imagin'd. -- William Blake Teyo Tyree ::: http://reductivelabs.com ::: +1.615.275.5066
> file {["$basedir", "$basedir/src", "$basedir/src/my",
> "$basedir/src/my/dir", "$basedir/src/my/dir/path" ]: #Just pass the
> file resource an array of files.
> mode => 0755,
> owner => jeff,
> group => jeff,
> ensure => directory,
> recurse => true
> }
Because resources do not have implicit ordering, you might run into
dependency problems with this example.
If you're not lucky enough, Puppet might try to create
"$basedir/src/my/dir/path" before "$basedir".
no. afair puppet manages ordering within fileresources automagically.
greets pete
The file { [ '/foo', '/foo/bar' ]: } syntax is currently the best way
to achieve this, although with a Parser function you could split a
full path into an array of resources to be managed, to cut down on
typing/repetition.
I recall Paul Lathrop was working on upwards recursion a while back..
There's a ticket open with some details in Redmine.
Regards,
AJ
Files will automatically require their parent directories, if you're
managing them, so you don't need to worry about setting up these
relationships.
--
I can't understand why a person will take a year to write a novel when
he can easily buy one for a few dollars. -- Fred Allen
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com