----- "Markus Roberts" <[email protected]> wrote:

> > I was thinking a function could work for the people who really want
> > this feature and that way we're not creating issues with the way
> the
> > file type actually works.
> >
> > $mypath = "/usr/local/foo/bin"
> >
> > file { path_components($mypath):
> >  ensure => directiory,
> > }
> >
> > and path_components just returns an array:
> >
> > ['/usr', '/usr/local', '/usr/local/foo', '/usr/local/bin']
> 
> +1 Sweet!
> 
> Could be as simple as something like:
> 
> module Puppet::Parser::Functions
>   newfunction(:path_components, :type => :rvalue) do |args|
>     File.split(args[0]).inject([]) { |segements,segment| segments <<
> File.join((segments.last || ''),segment) }
>   end
> end
> 


We discussed such a solution a while ago on IRC, this is pretty good, we should 
just add the ability to set a start position, so that for example you don't try 
to manage /, /usr, /usr/local but only /usr/local/your and /usr/local/your/stuff

-- 
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