~ubuntu-branches/ubuntu/wily/puppet/wily-proposed

« back to all changes in this revision

Viewing changes to lib/puppet/parser/functions/template.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2014-10-24 13:47:15 UTC
  • mfrom: (3.1.64 sid)
  • Revision ID: package-import@ubuntu.com-20141024134715-6ig54u0c4gar36ss
Tags: 3.7.2-1
* Imported upstream release 3.7.2
* Declare compliance with Debian Policy 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :arity => -2, :doc =>
2
 
  "Evaluate a template and return its value.  See
3
 
  [the templating docs](http://docs.puppetlabs.com/guides/templating.html) for
4
 
  more information.
5
 
 
6
 
  Note that if multiple templates are specified, their output is all
7
 
  concatenated and returned as the output of the function.") do |vals|
 
2
  "Loads an ERB template from a module, evaluates it, and returns the resulting
 
3
  value as a string.
 
4
 
 
5
  The argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>`
 
6
  reference, which will load `<TEMPLATE FILE>` from a module's `templates`
 
7
  directory. (For example, the reference `apache/vhost.conf.erb` will load the
 
8
  file `<MODULES DIRECTORY>/apache/templates/vhost.conf.erb`.)
 
9
 
 
10
  This function can also accept:
 
11
 
 
12
  * An absolute path, which can load a template file from anywhere on disk.
 
13
  * Multiple arguments, which will evaluate all of the specified templates and
 
14
  return their outputs concatenated into a single string.") do |vals|
8
15
    vals.collect do |file|
9
16
      # Use a wrapper, so the template can't get access to the full
10
17
      # Scope object.