diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-06 13:36:40 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-09 14:08:57 -0800 |
commit | b4b5c07515cdde5acdf94803760f6043f4b17386 (patch) | |
tree | 07e220c00294b88c3800778d1a6663bcf3783689 /lib/chef | |
parent | 5c98184870658edf576a0662babdb8e6e3cd55f5 (diff) | |
download | chef-b4b5c07515cdde5acdf94803760f6043f4b17386.tar.gz |
add Chef::Config[:chef_gem_compile_time] plus RELNOTES
* added a config flag to force chef_gem to behave like Chef-10/11
or to behave like Chef-13.
* added a bunch of release notes to explain the warnings and what to
do about them in quite a bit of detail.
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/application.rb | 7 | ||||
-rw-r--r-- | lib/chef/config.rb | 7 | ||||
-rw-r--r-- | lib/chef/resource/chef_gem.rb | 8 |
3 files changed, 18 insertions, 4 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb index 5a67fc9091..00992fdec1 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -49,6 +49,7 @@ class Chef configure_logging configure_proxy_environment_variables configure_encoding + emit_warnings end # Get this party started @@ -372,6 +373,12 @@ class Chef ENV end + def emit_warnings + if Chef::Config[:chef_gem_compile_time] + Chef::Log.warn "setting chef_gem_compile_time to true is deprecated" + end + end + class << self def debug_stacktrace(e) message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 1a4ec06d98..c9e0914c0b 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -627,6 +627,13 @@ class Chef # default :no_lazy_load, true + # Default for the chef_gem compile_time attribute. Nil is the same as false but will emit + # warnings on every use of chef_gem prompting the user to be explicit. If the user sets this to + # true then the user will get backcompat behavior but with a single nag warning that cookbooks + # may break with this setting in the future. The false setting is the recommended setting and + # will become the default. + default :chef_gem_compile_time, nil + # A whitelisted array of attributes you want sent over the wire when node # data is saved. # The default setting is nil, which collects all data. Setting to [] will not diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb index 126e3d56c3..c95bf03200 100644 --- a/lib/chef/resource/chef_gem.rb +++ b/lib/chef/resource/chef_gem.rb @@ -28,7 +28,7 @@ class Chef def initialize(name, run_context=nil) super @resource_name = :chef_gem - @compile_time = nil + @compile_time = Chef::Config[:chef_gem_compile_time] @gem_binary = RbConfig::CONFIG['bindir'] + "/gem" end @@ -53,9 +53,9 @@ class Chef # Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled # Action could be an array of symbols, but probably won't (think install + enable for a package) if compile_time.nil? - Chef::Log.warn "The chef_gem installation at compile time is deprecated and this behavior will change in the future." - Chef::Log.warn "Please set `compile_time false` on the resource to use the new behavior and suppress this warning," - Chef::Log.warn "or you may set `compile_time true` on the resource if compile_time behavior is necessary." + Chef::Log.warn "#{self} chef_gem compile_time installation is deprecated" + Chef::Log.warn "#{self} Please set `compile_time false` on the resource to use the new behavior." + Chef::Log.warn "#{self} or set `compile_time true` on the resource if compile_time behavior is required." end if compile_time || compile_time.nil? |