class Puppet::Parser::CatalogCompiler

A Catalog “compiler” that is like the regular compiler but with an API that is harmonized with the ScriptCompiler

The Script compiler is “one shot” - it does not support rechecking if underlying source has changed or deal with possible errors in a cached environment.

Public Instance Methods

compile() click to toggle source

Evaluates the configured setup for a script + code in an environment with modules

Calls superclass method Puppet::Parser::Compiler::compile
   # File lib/puppet/parser/catalog_compiler.rb
15 def compile
16   Puppet[:strict_variables] = true
17   Puppet[:strict] = :error
18 
19   Puppet.override(rich_data: true) do
20     super
21   end
22 
23 rescue Puppet::ParseErrorWithIssue => detail
24   detail.node = node.name
25   Puppet.log_exception(detail)
26   raise
27 rescue => detail
28   message = "#{detail} on node #{node.name}"
29   Puppet.log_exception(detail, message)
30   raise Puppet::Error, message, detail.backtrace
31 end
compile_additions() click to toggle source

Evaluates all added constructs, and validates the resulting catalog. This can be called whenever a series of evaluation of puppet code strings have reached a stable state (essentially that there are no relationships to non-existing resources).

Raises an error if validation fails.

   # File lib/puppet/parser/catalog_compiler.rb
40 def compile_additions
41   evaluate_additions
42   validate
43 end
evaluate_additions() click to toggle source

Evaluates added constructs that are lazily evaluated until all of them have been evaluated.

   # File lib/puppet/parser/catalog_compiler.rb
47 def evaluate_additions
48   evaluate_generators
49   finish
50 end
validate() click to toggle source

Validates the current state of the catalog. Does not cause evaluation of lazy constructs.

   # File lib/puppet/parser/catalog_compiler.rb
54 def validate
55   validate_catalog(CatalogValidator::FINAL)
56 end