diff options
author | danielsdeleo <dan@getchef.com> | 2015-02-06 14:58:26 -0800 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-02-06 15:00:57 -0800 |
commit | 74db11c60c3d39f72e4d09c88aa642af60bbb49d (patch) | |
tree | 3090cd88a5c71b51f12a5c1b34dbd8069d5bc82c /lib/chef/config.rb | |
parent | e89989bd04f428c0bc0cd5ce0c459c35ebd54afe (diff) | |
download | chef-74db11c60c3d39f72e4d09c88aa642af60bbb49d.tar.gz |
Add config to treat deprecation warnings as errors
Diffstat (limited to 'lib/chef/config.rb')
-rw-r--r-- | lib/chef/config.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 3fa7309edb..1a4ec06d98 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -499,6 +499,21 @@ class Chef # Deprecated: default(:cache_options) { { :path => PathHelper.join(file_cache_path, "checksums") } } + # Whether errors should be raised for deprecation warnings. When set to + # `false` (the default setting), a warning is emitted but code using + # deprecated methods/features/etc. should work normally otherwise. When set + # to `true`, usage of deprecated methods/features will raise a + # `DeprecatedFeatureError`. This is used by Chef's tests to ensure that + # deprecated functionality is not used internally by Chef. End users + # should generally leave this at the default setting (especially in + # production), but it may be useful when testing cookbooks or other code if + # the user wishes to aggressively address deprecations. + default(:treat_deprecation_warnings_as_errors) do + # Using an environment variable allows this setting to be inherited in + # tests that spawn new processes. + ENV.key?("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS") + end + # knife configuration data config_context :knife do default :ssh_port, nil |