summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/client.rb10
-rw-r--r--spec/unit/client_spec.rb6
2 files changed, 4 insertions, 12 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 769d1a4989..a89bc0ee73 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -327,14 +327,8 @@ class Chef
# @api private
def warn_if_eol
- require_relative "version"
-
- # We make a release every year so take the version you're on + 2006 and you get
- # the year it goes EOL
- eol_year = 2006 + Gem::Version.new(Chef::VERSION).segments.first
-
- if Time.now > Time.new(eol_year, 5, 01)
- logger.warn("This release of #{Chef::Dist::PRODUCT} became end of life (EOL) on May 1st #{eol_year}. Please update to a supported release to receive new features, bug fixes, and security updates.")
+ 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
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 8553c52b79..942c0346e3 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -308,15 +308,13 @@ describe Chef::Client do
end
describe "eol release warning" do
- it "warns when running an EOL release" do
- stub_const("Chef::VERSION", 15)
+ 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 running an non-EOL release" do
- stub_const("Chef::VERSION", 15)
+ 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