lib/chef/application.rb in chef-10.16.0.rc.0 vs lib/chef/application.rb in chef-10.16.0.rc.1

- old
+ new

@@ -32,10 +32,12 @@ end def initialize super + @chef_client = nil + @chef_client_json = nil trap("TERM") do Chef::Application.fatal!("SIGTERM received, stopping", 1) end trap("INT") do @@ -125,16 +127,27 @@ # Actually run the application def run_application raise Chef::Exceptions::Application, "#{self.to_s}: you must override run_application" end + # Initializes Chef::Client instance and runs it + def run_chef_client + @chef_client = Chef::Client.new( + @chef_client_json, + :override_runlist => config[:override_runlist] + ) + @chef_client_json = nil + + @chef_client.run + @chef_client = nil + end + private def apply_config(config_file_path) Chef::Config.from_file(config_file_path) Chef::Config.merge!(config) end - class << self def debug_stacktrace(e) message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" chef_stacktrace_out = "Generated at #{Time.now.to_s}\n"