diff options
author | Helen Campbell <helen@puppetlabs.com> | 2016-11-07 14:52:12 +0000 |
---|---|---|
committer | Helen Campbell <helen@puppetlabs.com> | 2016-11-21 14:35:42 +0000 |
commit | 64abfc99c6222f22ccfbb39ae9ece5ccd41fa25c (patch) | |
tree | d4dca97d5188c4aebe3f4e4206c3f141180516bd /lib/puppet | |
parent | dcef77af4cef2870874f76c06e92f601aeb5bc0c (diff) |
Call site display for deprecation warnings
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/functions/deprecation.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/functions/deprecation.rb b/lib/puppet/functions/deprecation.rb index a860aa2..7082068 100644 --- a/lib/puppet/functions/deprecation.rb +++ b/lib/puppet/functions/deprecation.rb @@ -8,15 +8,19 @@ Puppet::Functions.create_function(:deprecation) do end def deprecation(key, message) + stacktrace = Puppet::Pops::PuppetStack.stacktrace() + file = stacktrace[0] + line = stacktrace[1] + output_message = "#{message} at #{file}:#{line}" # depending on configuration setting of strict case Puppet.settings[:strict] when :off # do nothing when :error - fail("deprecation. #{key}. #{message}") + fail("deprecation. #{key}. #{output_message}") else unless ENV['STDLIB_LOG_DEPRECATIONS'] == 'false' - Puppet.deprecation_warning(message, key) + Puppet.deprecation_warning(output_message, key) end end end |