module Puppet::Util::Warnings

Methods to help with handling warnings.

Protected Class Methods

maybe_log(message, klass) { || ... } click to toggle source
# File lib/puppet/util/warnings.rb, line 21
def self.maybe_log(message, klass)
  @stampwarnings ||= {}
  @stampwarnings[klass] ||= []
  return nil if @stampwarnings[klass].include? message
  yield
  @stampwarnings[klass] << message
  nil
end

Public Instance Methods

clear_warnings() click to toggle source
# File lib/puppet/util/warnings.rb, line 14
def clear_warnings
  @stampwarnings = {}
  nil
end
notice_once(msg) click to toggle source
# File lib/puppet/util/warnings.rb, line 5
def notice_once(msg)
  Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.notice msg }
end
warnonce(msg) click to toggle source
# File lib/puppet/util/warnings.rb, line 10
def warnonce(msg)
  Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.warning msg }
end