diff options
author | David Schmitt <david.schmitt@puppet.com> | 2016-11-21 16:33:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-21 16:33:54 +0000 |
commit | 3762f301772cafc33c2e74356ebba287086869aa (patch) | |
tree | bae18ee10ae125473a9cadda3cf899f1088a3975 /lib/puppet | |
parent | ed97cd976eaf711856a1ac5ee087ddf0aa2225a2 (diff) | |
parent | 64abfc99c6222f22ccfbb39ae9ece5ccd41fa25c (diff) |
Merge pull request #685 from HelenCampbell/errorDetail
Call site output 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 |