I''m relatively new to puppet. Searched online, and could not find an answer to this. I have the following manifest snippet... class openvpn { package { openvpn: ensure => latest } file { "/usr/share/openvpn/easy-rsa/2.0/keys": ensure => directory, owner => root, group => root, mode => 600, file { "/usr/share/openvpn/easy-rsa/2.0/keys/ca.crt": source => "puppet://$server/openvpn/ca.crt", owner => root, group => root, mode => 600, require => File["/usr/share/openvpn/easy-rsa/2.0/keys"], } } Puppet is complaining with... Jun 19 11:35:59 node1 puppetd[3553]: (//Node[basenode]/openvpn/File[/ usr/share/openvpn/easy-rsa/2.0/keys]/ensure) change from absent to directory failed: Cannot create /usr/share/openvpn/easy-rsa/2.0/ keys; parent directory /usr/share/openvpn/easy-rsa/2.0 does not exist 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. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
2009/6/19 Douglas <doug.garstang@gmail.com>> > 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 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": .r'' p.s. puppet is smart enough to handle adding the dependency between the directory and the file within that directory so you don''t need that one require you already have. Also you can save yourself some typing by doing: file { "/dir": ensure => directory, mode => 644; "/dir/file": content => "blah"; } just note the ";" between items. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Meier
2009-Jun-19 19:12 UTC
[Puppet Users] Re: Automatically creating subdirectories?
Hi> Yeah, this is an old and know issue (unfortunately). > > Original bug report: > http://projects.reductivelabs.com/issues/86well 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 --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Douglas Garstang
2009-Jun-19 19:13 UTC
[Puppet Users] Re: Automatically creating subdirectories?
Thanks. Good to know I wasn''t missing something. On Fri, Jun 19, 2009 at 11:43 AM, Douglas <doug.garstang@gmail.com> wrote:> > I''m relatively new to puppet. > > Searched online, and could not find an answer to this. I have the > following manifest snippet... > > class openvpn { > package { openvpn: ensure => latest } > file { > "/usr/share/openvpn/easy-rsa/2.0/keys": > ensure => directory, owner => root, group => root, mode => > 600, > file { > "/usr/share/openvpn/easy-rsa/2.0/keys/ca.crt": > source => "puppet://$server/openvpn/ca.crt", > owner => root, group => root, mode => 600, > require => File["/usr/share/openvpn/easy-rsa/2.0/keys"], > } > } > > Puppet is complaining with... > Jun 19 11:35:59 node1 puppetd[3553]: (//Node[basenode]/openvpn/File[/ > usr/share/openvpn/easy-rsa/2.0/keys]/ensure) change from absent to > directory failed: Cannot create /usr/share/openvpn/easy-rsa/2.0/ > keys; parent directory /usr/share/openvpn/easy-rsa/2.0 does not exist > > 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. > > > > > > > > > >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2009-Jun-22 12:52 UTC
[Puppet Users] Automatically creating subdirectories?
RijilV wrote:> 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 --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---