Skip to content

Call site output for deprecation warnings #685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

HelenCampbell
Copy link
Contributor

No description provided.

@HelenCampbell HelenCampbell changed the title Call site output for deprecation warnings (Do not merge) Call site output for deprecation warnings Nov 7, 2016
@HelenCampbell HelenCampbell reopened this Nov 10, 2016
@HelenCampbell HelenCampbell changed the title (Do not merge) Call site output for deprecation warnings Call site output for deprecation warnings Nov 10, 2016
@tphoney
Copy link
Contributor

tphoney commented Nov 10, 2016

msg should be named something more obvious, maybe message_and_stracktrace

@tphoney
Copy link
Contributor

tphoney commented Nov 10, 2016

or output_message

@HelenCampbell HelenCampbell force-pushed the errorDetail branch 2 times, most recently from b008a75 to 38ff8d6 Compare November 10, 2016 14:51
@@ -8,15 +8,17 @@
end

def deprecation(key, message)
stacktrace = Puppet::Pops::PuppetStack.stacktrace()
output_message = message + ' - File and Line: ' + stacktrace[0].inspect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-use message here, saves you editing below.

Also, please format the message as "${message} at ${stacktrace[0][0]}:${stacktrace[0]:[1]}" to match common conventions on error reporting.

@HelenCampbell HelenCampbell changed the title Call site output for deprecation warnings (WIP) Call site output for deprecation warnings Nov 11, 2016
@HelenCampbell HelenCampbell changed the title (WIP) Call site output for deprecation warnings Call site output for deprecation warnings Nov 21, 2016
@DavidS DavidS merged commit 3762f30 into puppetlabs:master Nov 21, 2016
@@ -8,15 +8,19 @@
end

def deprecation(key, message)
stacktrace = Puppet::Pops::PuppetStack.stacktrace()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidS I'm sorry I keep doing this to you, but ...

Evaluation Error: Error while evaluating a Function Call, uninitialized constant Puppet::Pops::PuppetStack
https://travis-ci.org/voxpupuli/puppet-gluster/jobs/177770318#L917

That's puppet 3 with future parser enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, thanks for catching that. I know how that happened: https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/spec/functions/deprecation_spec.rb#L3 is a little too optimistic...

:-(

We'll retry tomorrow.

@bmjen
Copy link
Contributor

bmjen commented Nov 21, 2016

@DavidS @HelenCampbell @alexjfisher I'm going to revert this PR for now.

@bmjen
Copy link
Contributor

bmjen commented Nov 21, 2016

The Puppet::Pops::PuppetStack module has only been available since Puppet 4.6.0.
puppetlabs/puppet@2211c64

HelenCampbell pushed a commit to HelenCampbell/puppetlabs-stdlib that referenced this pull request Nov 24, 2016
A previous PR (puppetlabs#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants