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

Can't turn off deprecation warnings



    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 5.0.0
    • None
    • Agent
    • 1
    • Agent 2017-06-14
    • Needs Assessment
    • Bug Fix
    • Some deprecation warnings were issued even when using {{\--disable_warnings deprecations}}.
    • Manual
    • We should verify this works correctly now


      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




            Unassigned Unassigned
            josh Josh Cooper
            Eric Delaney Eric Delaney
            0 Vote for this issue
            1 Start watching this issue



              Zendesk Support