Sha256: 677efb111903badc20c012566f3682e4dbbfca8b9fb81a5231fb8eec88ac75f1

Contents?: true

Size: 922 Bytes

Versions: 3

Compression:

Stored size: 922 Bytes

Contents

Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :doc => 
    "Evaluate a template and return its value.  See `the templating docs 
    </trac/puppet/wiki/PuppetTemplating>`_ for more information.  Note that 
    if multiple templates are specified, their output is all concatenated 
    and returned as the output of the function.") do |vals|
        require 'erb'

        vals.collect do |file|
            # Use a wrapper, so the template can't get access to the full
            # Scope object.
            debug "Retrieving template %s" % file

            wrapper = Puppet::Parser::TemplateWrapper.new(self)
            wrapper.file = file
            begin
                wrapper.result
            rescue => detail
                raise Puppet::ParseError,
                    "Failed to parse template %s: %s" %
                        [file, detail]
            end
        end.join("")
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-0.24.9 lib/puppet/parser/functions/template.rb
puppet-0.24.7 lib/puppet/parser/functions/template.rb
puppet-0.24.8 lib/puppet/parser/functions/template.rb