summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-04-15 15:48:21 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-15 19:44:50 -0700
commitfeca88dfe07db2370b891680f8dd2c81b9d49de1 (patch)
treec2193efa97c01e8da9f3f94cb6a8cc26d163c16a
parent40e92b52ac0e274433d139723846fca4847b9ed6 (diff)
downloadchef-feca88dfe07db2370b891680f8dd2c81b9d49de1.tar.gz
Add a warning to the end of the chef run for EOL releses
We really want to encourage people to upgrade. One way we can do this is to just warn them that they're on an EOL release. This simple warning might nudge them to upgrade their client. It's works off the base EOL data of Chef 15 and takes the current release to add to that date. That way we don't have to maintain anything and as long as we keep a yearly release we're good. If we change the schedule then we either remove this or update the logic. That's a risk in shipping code that doesn't fire for 2 years. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/client.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index eceed0aa7e..4985d6ea1d 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,22 @@ class Chef
#
# @api private
+ 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)
+
+ 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.")
+ end
+ end
+
+ # @api private
def configure_formatters
formatters_for_run.map do |formatter_name, output_path|
if output_path.nil?