summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-04-15 18:39:38 -0700
committerGitHub <noreply@github.com>2020-04-15 18:39:38 -0700
commit9d06f6748c5794dec83a4befbcbf887eb41ff6b5 (patch)
treeae5b69bc3e22176702e2c074414a88d4c03b81b0 /lib
parent00401f60e859ac2e06c13108a3e99035afcf4e3d (diff)
parent1055333ac4d4912ac671bca07bc3cd430cd2ef64 (diff)
downloadchef-9d06f6748c5794dec83a4befbcbf887eb41ff6b5.tar.gz
Merge pull request #9666 from chef/eol_release_warning
Add a warning to the end of the chef run for EOL releses
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/client.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index eceed0aa7e..769d1a4989 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,19 @@ 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.")
+ end
+ end
+
+ # @api private
def configure_formatters
formatters_for_run.map do |formatter_name, output_path|
if output_path.nil?