-
Notifications
You must be signed in to change notification settings - Fork 581
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
The deprecation
function and Puppet 8 are not compatible
#1391
Comments
Or taking a step back: a warning is only useful if someone ends up acting on it, but with a deprecation there is no immediate need. So which ways are there that a user could act on it? CI is a good place. Probably the best if there is coverage, but we all know there isn't perfect coverage. So you need tooling (likely in rspec-puppet) to force deprecations to be fatal. But what if you don't have coverage? How does this show up in reports? I come from a Foreman background so for me the way to see how my fleet is doing is by Puppetserver sending reports to Foreman which I then see. Not that I checked, but I don't think that's handled today. Overall I do agree it should be configurable using the |
I agree with @ekohl about needing the ability to know a deprecation is happening and alert/error in testing but I would also say we should make how puppet and how stdlib handle it the same for catalog compilation. I'd go so far as to say that the stdlib function should just be a shorthand/easy way to call the Puppet namespaced function. |
Yes I completely agree. I'd also add that "force deprecations to be fatal" should be opt-in and is a major blocker for puppet8 adoption, as currently puppetserver8 in its default configuration will fail compilation when the Is there a non-hacky way for functions to know they are executing in the context of rspec-puppet now? If so, the
I agree that the |
As a user I think the most logical place is the compile matcher. Today you have: it { is_expected.to compile }
# or
it { is_expected.to compile.with_all_deps }
# or
it { is_expected.to compile.and_raise_error(/the error/) } Perhaps that could be modified to also check for deprecations? You then have to choose whether it's opt-in or opt-out. So I'm leaning to the latter because it requires fewer changes to existing specs to also check for deprecations. You could also implement a setting for it. |
Describe the Bug
I wanted to discuss the issue of puppet's
strict
mode and thedeprecation
function in thepuppetlabs-stdlib
module. This was discussed previously in:#1365
#1373
https://tickets.puppetlabs.com/browse/PUP-11868
As described in those issues, the problem is that all deprecations become hard errors when "strict=error", which is the default in puppet8. In practice, this means you can't really use "strict=error" and need to relax the setting to "strict=warning".
Expected Behavior
I would expect the
deprecation
function to behave similarly to puppet when itsPuppet.deprecation_warning
method is called. That is, thestrict
setting should not control whether the deprecation warning is displayed or not. Instead, it should be controlled by thedisable_warnings=deprecations
setting, similar to how-Wno-deprecated-declarations
can silence warnings in GCC.From my perspective, the problem is that both puppet and stdlib are trying to decide how to handle deprecation warnings and the two approaches are not compatible. To understand the disconnect, suppose you call
Puppet.deprecation_warning('message', 'key')
. The warning is always displayed whenstrict
is set toerror
,warning
andoff
, respectively:In order to silence the deprecation, you can set
disable_warnings=deprecations
and this works even whenstrict=error
:Steps to Reproduce:
I would expect the following to print a deprecation warning instead of failing compilation:
I would expect the deprecation warning to be silenced and for compilation to succeed:
Proposal
deprecation
function is called withuse_strict_setting=true
andstrict != :off
, then only raise ifdisable_warnings
doesn't includedeprecations
.OR
and always just call
Puppet.deprecation_warning
. It's possible that folks could be relying on the raise behavior? Though I think it's doubtful becausestrict=error
wasn't actually usable prior to puppet8, see https://github.com/puppetlabs/puppet/wiki/Puppet-8-Compatibility#strict-modeThe text was updated successfully, but these errors were encountered: