diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-04-15 18:28:21 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-04-15 18:28:21 -0700 |
commit | 1055333ac4d4912ac671bca07bc3cd430cd2ef64 (patch) | |
tree | 3a8f1e6e55ca6a1a851ee51bd9540c0db6de88ab /lib/chef | |
parent | 8dd7e3dce2a91c4dcdada2f4adf26f51a4ed2e71 (diff) | |
download | chef-1055333ac4d4912ac671bca07bc3cd430cd2ef64.tar.gz |
Simplify the logic + improve the spec
Use 2006 as the base year. Chef 15 goes EOL next year on 5-1-2021 so
2006 + 15 = 2021 and then we know it.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/client.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 4985d6ea1d..769d1a4989 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -329,15 +329,12 @@ class Chef def warn_if_eol require_relative "version" - # we have a yearly release and we know 15 goes EOL in 2021 so calculate off that - # this way we don't have to update anything or maintain a hash of EOL dates - base_eol_year = 2022 - base_release = Gem::Version.new(15) + # 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 - diff_from_base_release = Gem::Version.new(Chef::VERSION).segments.first - base_release.segments.first - - if Time.now > Time.new(base_eol_year + diff_from_base_release, 5, 1) - logger.warn("This release of #{Chef::Dist::PRODUCT} became end of life (EOL) on May 1st #{base_eol_year + diff_from_base_release}. Please update to a supported release to receive new features, bug fixes, and security updates.") + 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.") end end |