Class Puppet::Parser::Compiler
In: lib/puppet/parser/compiler.rb
Parent: Object

Maintain a graph of scopes, along with a bunch of data about the individual catalog we‘re compiling.

Methods

Included Modules

Puppet::Util Puppet::Util::Errors

Attributes

catalog  [R] 
collections  [R] 
facts  [R] 
node  [R] 
node_scope  [R] 
parser  [R] 
resources  [R] 

Public Class methods

Set up our compile. We require a parser and a node object; the parser is so we can look up classes and AST nodes, and the node has all of the client‘s info, like facts and environment.

Public Instance methods

Add a collection to the global list.

Store a resource override.

Store a resource in our resource table.

Do we use nodes found in the code, vs. the external node sources?

Return the scope associated with a class. This is just here so that subclasses can set their parent scopes to be the scope of their parent class, and it‘s also used when looking up qualified variables.

Store the fact that we‘ve evaluated a class, and store a reference to the scope in which it was evaluated, so that we can look it up later.

Return a list of all of the defined classes.

Compiler our catalog. This mostly revolves around finding and evaluating classes. This is the main entry into our catalog.

LAK:FIXME There are no tests for this.

Return the node‘s environment.

Evaluate each specified class in turn. If there are any classes we can‘t find, just tag the catalog and move on. This method really just creates resource objects that point back to the classes, and then the resources are themselves evaluated later in the process.

Evaluate all of the classes specified by the node.

Return a resource by either its ref or its type and title.

Create a new scope, with either a specified parent scope or using the top scope. Adds an edge between the scope and its parent to the graph.

Find the parent of a given scope. Assumes scopes only ever have one in edge, which will always be true.

Return any overrides for the given resource.

The top scope is usually the top-level scope, but if we‘re using AST nodes, then it is instead the node‘s scope.

[Validate]