On Apr 10, 2010, at 9:01 PM, Luke Kanies wrote:

> And if your actual directory varies, it's pretty trivial to write a function 
> that expands a given file name into an array and does the equivalent of this 
> for any arbitrary directory.

Oh that's a better idea than what I came up with (it's in a define that gets 
called for 'bushy' mountpoint trees that are three levels deep, hence the 'if ! 
defined' guards)


        # note this only makes two levels of directories deep - mount point and 
its immediate parent
 
        $parentpath = inline_template("<%= arry = name.split('/'); if 
arry.length > 2; arry.slice(0..-2).join('/'); else name end %>")
        if ! defined(File["$parentpath"]) {
            file { "$parentpath":  ensure => directory }
        }

        # make sure the mountpoint exists, create it as a directory if not
        if ! defined(File["${name}"]) {
                file { "${name}": ensure => directory }
        }

That's almost the function inline there, it's just in the wrong form. 

-=Eric
http://twitter.com/ahpook

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to