Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-7611

Can't turn off deprecation warnings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.0.0
    • Component/s: None
    • Template:
    • Sub-team:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-06-14
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Some deprecation warnings were issued even when using {{\--disable_warnings deprecations}}.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      We should verify this works correctly now

      Description

      There are a few different issues with how warn_once is implemented that prevent deprecation warnings from being silenced.

      1. There are typos, e.g. deprecatation
      2. We use both symbols and strings:

        Puppet.warn_once('deprecation', 'AST::ResourceParam', _('Use of Puppet::Parser::AST::ResourceParam is deprecated and not fully functional'))
        Puppet.warn_once(:deprecation, "metadata.json#data_provider-#{module_name}",
        

      3. The warn_once logic doesn't account for string vs symbol, which probably wasn't a problem before we removed the symbol string monkey_patch:

            return if Puppet[:disable_warnings].include?(kind)
        

      4. The disable_warnings setting only accepts plural deprecations, but all of the warn_once call sites use singular deprecation, so the include? check never matches
      5. There is another warnonce method defined in Puppet::Util::Warnings.

      But the main issue is that you can't turn deprecations off:

      notify { '1':
        message => strftime("%s")
      }
      notify { '2':
        message => strftime("%s")
      }
      

      $ bundle exec puppet apply warnings.pp --disable_warnings deprecations
      /Users/josh/work/puppet/.bundle/ruby/2.4.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbCFTypes.rb:24: warning: constant ::Fixnum is deprecated
      Warning: The argument signature (String format, [String timezone]) is deprecated for #strfime. See #strftime documentation and Timespan type for more info
         (file & line not available)
      Notice: Compiled catalog for chara.corp.puppetlabs.net in environment production in 0.02 seconds
      Notice: 1496267306
      Notice: /Stage[main]/Main/Notify[1]/message: defined 'message' as '1496267306'
      Notice: 1496267306
      Notice: /Stage[main]/Main/Notify[2]/message: defined 'message' as '1496267306'
      Notice: 1496267306
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            josh Josh Cooper
            QA Contact:
            Eric Delaney Eric Delaney
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support