summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil Chouhan <kapil.chouhan@msystechnologies.com>2020-11-10 17:20:38 +0530
committerKapil Chouhan <kapil.chouhan@msystechnologies.com>2020-11-10 17:20:38 +0530
commitf272982af1c434425d6191d2b996e9af22aa38e7 (patch)
tree09c06d98d279f12c77474a428a6454b54b1f7f44
parent69147fc6d93b120040c735318b6fc1d09a638933 (diff)
downloadchef-f272982af1c434425d6191d2b996e9af22aa38e7.tar.gz
Added deprecation warning for enforce_path_sanity
Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
-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