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
14 def compile
15   Puppet[:strict_variables] = true
16   Puppet[:strict] = :error
17 
18   Puppet.override(rich_data: true) do
19     super
20   end
21 
22 rescue Puppet::ParseErrorWithIssue => detail
23   detail.node = node.name
24   Puppet.log_exception(detail)
25   raise
26 rescue => detail
27   message = "#{detail} on node #{node.name}"
28   Puppet.log_exception(detail, message)
29   raise Puppet::Error, message, detail.backtrace
30 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
39 def compile_additions
40   evaluate_additions
41   validate
42 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
46 def evaluate_additions
47   evaluate_generators
48   finish
49 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
53 def validate
54   validate_catalog(CatalogValidator::FINAL)
55 end