Class: Puppet::Parser::CatalogCompiler
- Defined in:
- lib/puppet/parser/catalog_compiler.rb
Overview
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.
Constant Summary
Constants included from Puppet::Pops::Evaluator::Runtime3Support
Puppet::Pops::Evaluator::Runtime3Support::NAME_SPACE_SEPARATOR
Constants included from Util
Util::ALNUM, Util::ALPHA, Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE, Util::ESCAPED, Util::HEX, Util::HttpProxy, Util::PUPPET_STACK_INSERTION_FRAME, Util::RESERVED, Util::RFC_3986_URI_REGEX, Util::UNRESERVED, Util::UNSAFE
Constants included from Util::POSIX
Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS
Constants included from Util::SymbolicFileMode
Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit
Instance Attribute Summary
Attributes inherited from Compiler
#catalog, #code_id, #collections, #facts, #loaders, #node, #qualified_variables, #relationships, #resources, #topscope
Instance Method Summary collapse
-
#compile ⇒ Object
Evaluates the configured setup for a script + code in an environment with modules.
-
#compile_additions ⇒ Object
Evaluates all added constructs, and validates the resulting catalog.
-
#evaluate_additions ⇒ Object
Evaluates added constructs that are lazily evaluated until all of them have been evaluated.
-
#validate ⇒ Object
Validates the current state of the catalog.
Methods inherited from Compiler
#add_catalog_validator, #add_catalog_validators, #add_class, #add_override, #add_resource, compile, #context_overrides, #environment, #evaluate_ast_node, #evaluate_classes, #evaluate_node_classes, #evaluate_relationships, #initialize, #newscope, #resource_overrides, #validate_catalog, #with_context_overrides
Methods included from Puppet::Pops::Evaluator::Runtime3Support
#add_relationship, #call_function, #capitalize_qualified_name, #coerce_numeric, #convert, #create_local_scope_from, #create_match_scope_from, #create_resource_defaults, #create_resource_overrides, #create_resource_parameter, #create_resources, #diagnostic_producer, #external_call_function, #extract_file_line, #fail, #find_resource, #get_resource_parameter_value, #get_scope_nesting_level, #get_variable_value, #is_parameter_of_resource?, #is_true?, #optionally_fail, #runtime_issue, #set_match_data, #set_scope_nesting_level, #set_variable, #variable_bound?, #variable_exists?
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, error_location, error_location_with_space, error_location_with_unknowns, #exceptwrap, #fail
Methods included from Util
absolute_path?, benchmark, chuser, clear_environment, create_erb, default_env, deterministic_rand, deterministic_rand_int, exit_on_fail, format_backtrace_array, format_puppetstack_frame, get_env, get_environment, logmethods, merge_environment, path_to_uri, pretty_backtrace, replace_file, resolve_stackframe, rfc2396_escape, safe_posix_fork, set_env, skip_external_facts, symbolizehash, thinmark, uri_encode, uri_query_encode, uri_to_path, uri_unescape, which, withenv, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, groups_of, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::SymbolicFileMode
#display_mode, #normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?
Methods included from AbstractCompiler
#catalog, #environment, #newscope, #qualified_variables, #topscope
Constructor Details
This class inherits a constructor from Puppet::Parser::Compiler
Instance Method Details
#compile ⇒ Object
Evaluates the configured setup for a script + code in an environment with modules
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/puppet/parser/catalog_compiler.rb', line 15 def compile Puppet[:strict_variables] = true Puppet[:strict] = :error Puppet.override(rich_data: true) do super end rescue Puppet::ParseErrorWithIssue => detail detail.node = node.name Puppet.log_exception(detail) raise rescue => detail = "#{detail} on node #{node.name}" Puppet.log_exception(detail, ) raise Puppet::Error, , detail.backtrace end |
#compile_additions ⇒ Object
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.
39 40 41 42 |
# File 'lib/puppet/parser/catalog_compiler.rb', line 39 def compile_additions evaluate_additions validate end |
#evaluate_additions ⇒ Object
Evaluates added constructs that are lazily evaluated until all of them have been evaluated.
46 47 48 49 |
# File 'lib/puppet/parser/catalog_compiler.rb', line 46 def evaluate_additions evaluate_generators finish end |
#validate ⇒ Object
Validates the current state of the catalog. Does not cause evaluation of lazy constructs.
53 54 55 |
# File 'lib/puppet/parser/catalog_compiler.rb', line 53 def validate validate_catalog(CatalogValidator::FINAL) end |