Class Puppet::Parser::Interpreter
In: lib/puppet/parser/interpreter.rb
Parent: Object

The interpreter is a very simple entry-point class that manages the existence of the parser (e.g., replacing it when files are reparsed). You can feed it a node and get the node‘s catalog back.

Methods

Included Modules

Puppet::Util Puppet::Util::Errors

Attributes

usenodes  [RW] 

Public Class methods

create our interpreter

[Source]

    # File lib/puppet/parser/interpreter.rb, line 37
37:     def initialize
38:         # The class won't always be defined during testing.
39:         if Puppet[:storeconfigs] 
40:             if Puppet.features.rails?
41:                 Puppet::Rails.init
42:             else
43:                 raise Puppet::Error, "Rails is missing; cannot store configurations"
44:             end
45:         end
46: 
47:         @parsers = {}
48:     end

Public Instance methods

evaluate our whole tree

[Source]

    # File lib/puppet/parser/interpreter.rb, line 26
26:     def compile(node)
27:         raise Puppet::ParseError, "Could not parse configuration; cannot compile on node %s" % node.name unless env_parser = parser(node.environment)
28:         begin
29:           return Puppet::Parser::Compiler.new(node, env_parser).compile
30:         rescue => detail
31:           puts detail.backtrace if Puppet[:trace]
32:           raise Puppet::Error, detail.to_s + " on node %s" % node.name
33:         end
34:     end

Determine the configuration version for a given node‘s environment.

[Source]

    # File lib/puppet/parser/interpreter.rb, line 21
21:     def configuration_version(node)
22:         parser(node.environment).version
23:     end

Return the parser for a specific environment.

[Source]

    # File lib/puppet/parser/interpreter.rb, line 51
51:     def parser(environment)
52:         if ! @parsers[environment] or @parsers[environment].reparse?
53:             # This will throw an exception if it does not succeed.
54:             @parsers[environment] = create_parser(environment)
55:         end
56:         @parsers[environment]
57:     end

[Validate]