Skip to content

Commit 746c1f8

Browse files
author
Helen Campbell
committed
Deprecation - Use puppet stacktrace if available
A previous PR (#685) was raised on this issue, however once it was merged it was discovered that Puppet 3 with future parser enabled was calling the Puppet 4 version of the deprecation function. The Puppet stacktrace is not available until Puppet 4.6, so this was breaking existing setups. The solution was to check is the stacktrace was defined, and if it was to use it as part of the message output.
1 parent 419f7d6 commit 746c1f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/puppet/functions/deprecation.rb

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
end
99

1010
def deprecation(key, message)
11+
if defined? Puppet::Pops::PuppetStack.stacktrace()
12+
stacktrace = Puppet::Pops::PuppetStack.stacktrace()
13+
file = stacktrace[0]
14+
line = stacktrace[1]
15+
message = "#{message} at #{file}:#{line}"
16+
end
1117
# depending on configuration setting of strict
1218
case Puppet.settings[:strict]
1319
when :off

0 commit comments

Comments
 (0)