Sha256: f1dfb5e6676784b49fd3d48e53ff3f2431023c858073c7aa4ae36c40b9bf3575

Contents?: true

Size: 720 Bytes

Versions: 447

Compression:

Stored size: 720 Bytes

Contents

# Methods to help with handling warnings.
module Puppet::Util::Warnings
  module_function

  def notice_once(msg)
    Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.notice msg }
  end

  def debug_once(msg)
    return nil unless Puppet[:debug]
    Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.debug msg }
  end

  def warnonce(msg)
    Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.warning msg }
  end

  def clear_warnings
    @stampwarnings = {}
    nil
  end

  def self.maybe_log(message, klass)
    @stampwarnings ||= {}
    @stampwarnings[klass] ||= []
    return nil if @stampwarnings[klass].include? message
    yield
    @stampwarnings[klass] << message
    nil
  end
end

Version data entries

447 entries across 447 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/util/warnings.rb
puppet-7.34.0-x86-mingw32 lib/puppet/util/warnings.rb
puppet-7.34.0-x64-mingw32 lib/puppet/util/warnings.rb
puppet-7.34.0-universal-darwin lib/puppet/util/warnings.rb
puppet-7.33.0 lib/puppet/util/warnings.rb
puppet-7.33.0-x86-mingw32 lib/puppet/util/warnings.rb
puppet-7.33.0-x64-mingw32 lib/puppet/util/warnings.rb
puppet-7.33.0-universal-darwin lib/puppet/util/warnings.rb
puppet-7.32.1 lib/puppet/util/warnings.rb
puppet-7.32.1-x86-mingw32 lib/puppet/util/warnings.rb
puppet-7.32.1-x64-mingw32 lib/puppet/util/warnings.rb
puppet-7.32.1-universal-darwin lib/puppet/util/warnings.rb
puppet-7.31.0 lib/puppet/util/warnings.rb
puppet-7.31.0-x86-mingw32 lib/puppet/util/warnings.rb
puppet-7.31.0-x64-mingw32 lib/puppet/util/warnings.rb
puppet-7.31.0-universal-darwin lib/puppet/util/warnings.rb
puppet-7.30.0 lib/puppet/util/warnings.rb
puppet-7.30.0-x86-mingw32 lib/puppet/util/warnings.rb
puppet-7.30.0-x64-mingw32 lib/puppet/util/warnings.rb
puppet-7.30.0-universal-darwin lib/puppet/util/warnings.rb