I'm relatively new to puppet.
Searched online, and could not find an answer to this. I have the
following manifest snippet...
[snip]
Shouldn't puppet automatically create all the subdirectories above usr/
share/openvpn/easy-rsa/2.0 directory for me? If not, do I need to go
and create dependancies for every single node in the directory
hierarchy? That seems a little crazy. Isn't there a better way?
Thanks,
Doug.
> Yeah, this is an old and know issue (unfortunately).
>
> Original bug report:
> http://projects.reductivelabs.com/issues/86
well bug or more a philosphical question? The comments in the bug report
describe a bit the problem puppet would run into if puppet would
auto-create them.
puppet manages resources and isn't just executing a bunch of commands in
a certain order.
cheers pete
> Yeah, this is an old and know issue (unfortunately).
>
> Original bug report:
> http://projects.reductivelabs.com/issues/86
>
>
> You can work around it with a hackish exec:
>
> exec { "mkdir -p /usr/share/openvpn/easy-rsa/2.0/keys": }
>
> then tack that exec as a require to your file "/usr/share/openvpn/easy-rsa/
> 2.0/keys":
Inspired by this discussion, I just wrote a custom function that
could help in doing this, which I have attached. You would then
use it like this:
$x = dirtree("/usr/share/openvpn", "easy-rsa/2.0/keys")
file {
$x: ensure => directory;
}
dirtree() will return a list of all directories from /usr/share/openvpn
down to /usr/share/openvpn/easy-rsa/foo/bar. Passing that list to the
file type will make sure those exists. But, unlike using mkdir -p, it
will *not* create /usr or /usr/share, only /usr/share/openvpn and down.
Unfortunately, it seems that I need to assign the function return value
to a temporary variable ($x above). I would have liked to do
file {
dirtree("/usr/share/openvpn", "easy-rsa/2.0/keys"):
ensure => directory;
}
but at least the pre 0.25.0 snapshot I'm testing this with gives me
a syntax error for that. :-( I'll file a bug report for that.
/Bellman