Method: Puppet::Parser::Compiler#evaluate_ast_node

Defined in:
lib/puppet/parser/compiler.rb

#evaluate_ast_nodeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

If ast nodes are enabled, then see if we can find and evaluate one.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/puppet/parser/compiler.rb', line 208

def evaluate_ast_node
  krt = environment.known_resource_types
  return unless krt.nodes? # ast_nodes?

  # Now see if we can find the node.
  astnode = nil
  @node.names.each do |name|
    astnode = krt.node(name.to_s.downcase)
    break if astnode
  end

  unless astnode ||= krt.node("default")
    raise Puppet::ParseError, _("Could not find node statement with name 'default' or '%{names}'") % { names: node.names.join(", ") }
  end

  # Create a resource to model this node, and then add it to the list
  # of resources.
  resource = astnode.ensure_in_catalog(topscope)

  resource.evaluate

  @node_scope = topscope.class_scope(astnode)
end