diff options
author | Luke Kanies <luke@madstop.com> | 2008-12-02 16:26:54 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-12-02 16:26:54 -0600 |
commit | 99a9b5a045af6f1c68619792a45603cbe450652d (patch) | |
tree | 579963d464c0529d4e9250f937d495e415f1e867 /lib/puppet/parser/functions/inline_template.rb | |
parent | f73e13e7464edab73443857d628602b89361c220 (diff) | |
parent | 278bfe83015312292360f727d6532a143610db0d (diff) | |
download | puppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.gz puppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.xz puppet-99a9b5a045af6f1c68619792a45603cbe450652d.zip |
Merge branch '0.24.x'
Conflicts:
bin/puppetca
lib/puppet/type/group.rb
lib/puppet/type/tidy.rb
lib/puppet/util/settings.rb
Also edited the following files so tests will pass:
lib/puppet/type/component.rb
spec/unit/ssl/certificate_request.rb
spec/unit/type/computer.rb
spec/unit/type/mcx.rb
spec/unit/type/resources.rb
spec/unit/util/settings.rb
spec/unit/util/storage.rb
test/ral/type/zone.rb
Diffstat (limited to 'lib/puppet/parser/functions/inline_template.rb')
-rw-r--r-- | lib/puppet/parser/functions/inline_template.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/inline_template.rb b/lib/puppet/parser/functions/inline_template.rb new file mode 100644 index 000000000..289740873 --- /dev/null +++ b/lib/puppet/parser/functions/inline_template.rb @@ -0,0 +1,21 @@ +Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :doc => + "Evaluate a template string and return its value. See `the templating docs + </trac/puppet/wiki/PuppetTemplating>`_ for more information. Note that + if multiple template strings are specified, their output is all concatenated + and returned as the output of the function.") do |vals| + require 'erb' + + vals.collect do |string| + # Use a wrapper, so the template can't get access to the full + # Scope object. + + wrapper = Puppet::Parser::TemplateWrapper.new(self) + begin + wrapper.result(string) + rescue => detail + raise Puppet::ParseError, + "Failed to parse inline template: %s" % + [detail] + end + end.join("") +end |