> 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

(Warning: browser code sketch!!!  This is not real cvode, it's never
ever been run, tested, or looked at by anyone but me.  Just putting it
here to capture & share the thought of how easy it may be to implement
Nigel's idea)

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------

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