Method: Puppet::Parser::Compiler#compile

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

#compileObject

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



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/puppet/parser/compiler.rb', line 124

def compile
  Puppet.override(@context_overrides, _("For compiling %{node}") % { node: node.name }) do
    @catalog.environment_instance = environment

    # Set the client's parameters into the top scope.
    Puppet::Util::Profiler.profile(_("Compile: Set node parameters"), [:compiler, :set_node_params]) { set_node_parameters }

    Puppet::Util::Profiler.profile(_("Compile: Created settings scope"), [:compiler, :create_settings_scope]) { create_settings_scope }

    # TRANSLATORS "main" is a function name and should not be translated
    Puppet::Util::Profiler.profile(_("Compile: Evaluated main"), [:compiler, :evaluate_main]) { evaluate_main }

    Puppet::Util::Profiler.profile(_("Compile: Evaluated AST node"), [:compiler, :evaluate_ast_node]) { evaluate_ast_node }

    Puppet::Util::Profiler.profile(_("Compile: Evaluated node classes"), [:compiler, :evaluate_node_classes]) { evaluate_node_classes }

    Puppet::Util::Profiler.profile(_("Compile: Evaluated generators"), [:compiler, :evaluate_generators]) { evaluate_generators }

    Puppet::Util::Profiler.profile(_("Compile: Validate Catalog pre-finish"), [:compiler, :validate_pre_finish]) do
      validate_catalog(CatalogValidator::PRE_FINISH)
    end

    Puppet::Util::Profiler.profile(_("Compile: Finished catalog"), [:compiler, :finish_catalog]) { finish }

    fail_on_unevaluated

    Puppet::Util::Profiler.profile(_("Compile: Validate Catalog final"), [:compiler, :validate_final]) do
      validate_catalog(CatalogValidator::FINAL)
    end

    if block_given?
      yield @catalog
    else
      @catalog
    end
  end
end