Method: Chef::Application::Apply#get_recipe_and_run_context

Defined in:
lib/chef/application/apply.rb

#get_recipe_and_run_contextObject



199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/chef/application/apply.rb', line 199

def get_recipe_and_run_context
  Chef::Config[:solo_legacy_mode] = true
  @chef_client = Chef::Client.new(@json_attribs)
  @chef_client.run_ohai
  @chef_client.load_node
  @chef_client.build_node
  run_context = if @chef_client.events.nil?
                  Chef::RunContext.new(@chef_client.node, {})
                else
                  Chef::RunContext.new(@chef_client.node, {}, @chef_client.events)
                end
  recipe = Chef::Recipe.new("(#{ChefUtils::Dist::Apply::EXEC} cookbook)", "(#{ChefUtils::Dist::Apply::EXEC} recipe)", run_context)
  [recipe, run_context]
end