Issue #86 has been updated by Thomas Bellman.

File dirs_between.rb added

A better way than just saying 'create_parents => true', would be
'parents_upto => "/some/very"', and having that be exactly equivalent
to explicitly specifying every path inbetween "/some/very" and
"/some/very/long/path" as file resources with the same parameters.

A slightly different way of achieving this would be to have a function
dirs_between() that takes a directory and a subdirectory as arguments
and returns a list of all directories inbetween, including the two
endpoints.  dirs_between("/some/very", "long/path") would return the
list ["/some/very", "/some/very/long", "/some/very/long/path"].

One would then use that like

<pre>
    $dirs = dirs_between("/some/very", "long/path")
    file {
        $dirs:
            ensure => directory, owner => "someuser", mode => 0755;
    }
</pre>

(It would be nice to be able to have the dirs_between() call directly
in the file declaration, and not have the temporary variable $dirs,
but at least 0.25.0rc1 barfs on that.)

I'm attaching a quick and dirty implementation of dirs_between().  It
is sorely lacking in error handling, but seems to work as long as you
don't pass it bad parameters.
----------------------------------------
Feature #86: Directory creation fails if parent directory does not exist
http://projects.reductivelabs.com/issues/86

Author: Redmine Admin
Status: Accepted
Priority: Normal
Assigned to: 
Category: file
Target version: unplanned
Complexity: Medium
Patch: None
Affected version: 0.24.7
Keywords: feature


I tried 

file {"/usr/local/share/puppet/sopext/facter" : 
  ensure => directory, 
  recurse => true
}

but get erros that the parent diretories are not available.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to