Method: EasyType::Template#template

Defined in:
lib/easy_type/template.rb

#template(template_name, context) ⇒ String

This allows you to use an erb file. Just like in the normal Puppet classes. The file is searched in the template directory on the same level as the ruby library path. For most puppet classes this is eqal to the normal template path of a module

Examples:

template 'puppet:///modules/my_module_name/create_tablespace.sql.erb', binding

Parameters:

  • name (String)

    this is the name of the template to be used.

  • context (Binding)

    this is the binding to be used in the template

Returns:

  • (String)

    interpreted ERB template

Raises:

  • (ArgumentError)

    when the file doesn’t exist



36
37
38
39
40
41
42
# File 'lib/easy_type/template.rb', line 36

def template(template_name, context)
  if template_name =~ /puppet:/
    puppet_template(template_name, context)
  else
    local_template(template_name, context)
  end
end