summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-10 09:04:43 -0800
committerGitHub <noreply@github.com>2020-11-10 09:04:43 -0800
commit314dc51249db702ef7e8da7f31ca96c0808a5f89 (patch)
tree33ef94936b2b925cadcbacdb633d327d4142c9d6
parent4e62b317a97140c9c44a5f9ff15376992896690a (diff)
parentf272982af1c434425d6191d2b996e9af22aa38e7 (diff)
downloadchef-314dc51249db702ef7e8da7f31ca96c0808a5f89.tar.gz
Merge pull request #10613 from MsysTechnologiesllc/Kapil/Github-10201_Add_deprecation_for_enforce_path_sanity
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/client.rb2
-rw-r--r--spec/unit/client_spec.rb16
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 41e3846812..099c061a96 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -243,12 +243,12 @@ class Chef
run_status.run_context = run_context
events.run_start(Chef::VERSION, run_status)
-
logger.info("*** #{ChefUtils::Dist::Infra::PRODUCT} #{Chef::VERSION} ***")
logger.info("Platform: #{RUBY_PLATFORM}")
logger.info "#{ChefUtils::Dist::Infra::CLIENT.capitalize} pid: #{Process.pid}"
logger.info "Targeting node: #{Chef::Config.target_mode.host}" if Chef::Config.target_mode?
logger.debug("#{ChefUtils::Dist::Infra::CLIENT.capitalize} request_id: #{request_id}")
+ logger.warn("`enforce_path_sanity` is deprecated, please use `enforce_default_paths` instead!") if Chef::Config[:enforce_path_sanity]
ENV["PATH"] = ChefUtils::DSL::DefaultPaths.default_paths if Chef::Config[:enforce_default_paths] || Chef::Config[:enforce_path_sanity]
run_ohai
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 34c0a2c548..377a0b8f05 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -801,4 +801,20 @@ describe Chef::Client do
allow_any_instance_of(Chef::RunLock).to receive(:save_pid).and_raise(NoMethodError)
end
end
+
+ describe "deprecated enforce_path_sanity" do
+ include_context "a client run"
+ include_context "converge completed"
+
+ it "print a warning, when enforce_path_sanity is passed" do
+ Chef::Config[:enforce_path_sanity] = true
+ expect(logger).to receive(:warn).with("`enforce_path_sanity` is deprecated, please use `enforce_default_paths` instead!")
+ client.run
+ end
+
+ it "should not print a warning, when enforce_path_sanity is not passed" do
+ expect(logger).not_to receive(:warn).with("`enforce_path_sanity` is deprecated, please use `enforce_default_paths` instead!")
+ client.run
+ end
+ end
end