Sha256: 5845e3760e33d41256f73a3981d67df4fd90569a51cec44f8e266978898f907d

Contents?: true

Size: 733 Bytes

Versions: 232

Compression:

Stored size: 733 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

  protected

  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

232 entries across 232 versions & 3 rubygems

Version Path
puppet-retrospec-1.8.0 vendor/pup410/lib/puppet/util/warnings.rb
puppet-retrospec-1.7.0 vendor/pup410/lib/puppet/util/warnings.rb
puppet-5.3.7 lib/puppet/util/warnings.rb
puppet-5.3.7-x86-mingw32 lib/puppet/util/warnings.rb
puppet-5.3.7-x64-mingw32 lib/puppet/util/warnings.rb
puppet-5.3.7-universal-darwin lib/puppet/util/warnings.rb
puppet-4.10.12 lib/puppet/util/warnings.rb
puppet-4.10.12-x86-mingw32 lib/puppet/util/warnings.rb
puppet-4.10.12-x64-mingw32 lib/puppet/util/warnings.rb
puppet-4.10.12-universal-darwin lib/puppet/util/warnings.rb
puppet-4.10.11 lib/puppet/util/warnings.rb
puppet-4.10.11-x86-mingw32 lib/puppet/util/warnings.rb
puppet-4.10.11-x64-mingw32 lib/puppet/util/warnings.rb
puppet-4.10.11-universal-darwin lib/puppet/util/warnings.rb
puppet-5.3.6 lib/puppet/util/warnings.rb
puppet-5.3.6-x86-mingw32 lib/puppet/util/warnings.rb
puppet-5.3.6-x64-mingw32 lib/puppet/util/warnings.rb
puppet-5.3.6-universal-darwin lib/puppet/util/warnings.rb
bolt-0.17.1 vendored/puppet/lib/puppet/util/warnings.rb
bolt-0.17.0 vendored/puppet/lib/puppet/util/warnings.rb