On Sat, Nov 10, 2012 at 9:22 AM, woosley. xu. <redic...@gmail.com> wrote:

> Hi all,
>        I want to parse the puppet url in my customizes functions.  Eg,
>
>
>  module Puppet::Parser::Functions
>       newfunction(:load_file, ) do |arg|
>            path = get_real_path(arg[0])
>            load_file_content(path)
>       end
>     end
>
>
> suppose arg[0] is a puppet file url: 
> puppt:///module/someModule/fileName.yaml, how can I parse this url and get 
> the real os path of that file?
>
>
There isn't really a good and reliable way I can think of to do this.
 Functions are executed when a catalog is being compiled, but there is no
guarantee that the host compiling a catalog is also the same host that will
serve up file content and metadata.  In multiple-master configurations the
fileserver puppet master processes are often running on different hosts
than the catalog compiler puppet master processes.

What problem are you trying to solve?  Perhaps there is another approach
that does not require translating Puppet URI's to real paths.

-Jeff

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to