lib/chef/client.rb in chef-0.10.8 vs lib/chef/client.rb in chef-0.10.10.beta.1

- old
+ new

@@ -18,10 +18,11 @@ # See the License for the specific language governing permissions and # limitations under the License. require 'chef/config' require 'chef/mixin/params_validate' +require 'chef/mixin/path_sanity' require 'chef/log' require 'chef/rest' require 'chef/api_client' require 'chef/platform' require 'chef/node' @@ -34,19 +35,19 @@ require 'chef/cookbook/file_vendor' require 'chef/cookbook/file_system_file_vendor' require 'chef/cookbook/remote_file_vendor' require 'chef/version' require 'ohai' +require 'rbconfig' class Chef # == Chef::Client # The main object in a Chef run. Preps a Chef::Node and Chef::RunContext, # syncs cookbooks if necessary, and triggers convergence. class Client + include Chef::Mixin::PathSanity - SANE_PATHS = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin] - # Clears all notifications for client run status events. # Primarily for testing purposes. def self.clear_notifications @run_start_notifications = nil @run_completed_successfully_notifications = nil @@ -309,23 +310,9 @@ def converge(run_context) Chef::Log.debug("Converging node #{node_name}") @runner = Chef::Runner.new(run_context) runner.converge true - end - - def enforce_path_sanity(env=ENV) - if Chef::Config[:enforce_path_sanity] && RUBY_PLATFORM !~ /mswin|mingw32|windows/ - existing_paths = env["PATH"].split(':') - SANE_PATHS.each do |sane_path| - unless existing_paths.include?(sane_path) - env_path = env["PATH"].dup - env_path << ':' unless env["PATH"].empty? - env_path << sane_path - env["PATH"] = env_path - end - end - end end private def directory_not_empty?(path)