summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-04-16 10:44:02 -0700
committerGitHub <noreply@github.com>2020-04-16 10:44:02 -0700
commit57d4f3222b60872aac46f5487e15bc2d42a0f2e2 (patch)
tree1d2e4194c973237fed98785121d2aab7e6468784
parentcd8d728c93bdfbed99cba6ab9d50fff70e5b1ea9 (diff)
parentf5625991fcf1c722d430455ce602f2a1640c8c0c (diff)
downloadchef-57d4f3222b60872aac46f5487e15bc2d42a0f2e2.tar.gz
Merge pull request #9667 from chef/deprecation_warning_chef_15
Add deprecation warnings at the end of the run after the end of April 2021
-rw-r--r--lib/chef/client.rb9
-rw-r--r--spec/unit/client_spec.rb14
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index eceed0aa7e..a89bc0ee73 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -295,6 +295,8 @@ class Chef
# keep this inside the main loop to get exception backtraces
end_profiling
+ warn_if_eol
+
# rebooting has to be the last thing we do, no exceptions.
Chef::Platform::Rebooter.reboot_if_needed!(node)
rescue Exception => run_error
@@ -324,6 +326,13 @@ class Chef
#
# @api private
+ def warn_if_eol
+ if Time.now > Time.new(2021, 5, 01)
+ logger.warn("This release of #{Chef::Dist::PRODUCT} became end of life (EOL) on May 1st 2021. Please update to a supported release to receive new features, bug fixes, and security updates.")
+ end
+ end
+
+ # @api private
def configure_formatters
formatters_for_run.map do |formatter_name, output_path|
if output_path.nil?
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 37b7f30ad2..942c0346e3 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -307,6 +307,20 @@ describe Chef::Client do
end
end
+ describe "eol release warning" do
+ it "warns when the date is after April 30, 2021" do
+ allow(Time).to receive(:now).and_return(Time.new(2021, 5, 1, 5))
+ expect(logger).to receive(:warn).with(/This release of.*became end of life \(EOL\) on May 1st 2021/)
+ client.warn_if_eol
+ end
+
+ it "does not warn when date is before May 1st 2021" do
+ allow(Time).to receive(:now).and_return(Time.new(2021, 4, 31))
+ expect(logger).to_not receive(:warn).with(/became end of life/)
+ client.warn_if_eol
+ end
+ end
+
describe "authentication protocol selection" do
context "when FIPS is disabled" do
before do