module Puppet::Util::Warnings

Methods to help with handling warnings.

Public Instance Methods

clear_warnings() click to toggle source
# File lib/puppet/util/warnings.rb, line 17
def clear_warnings
  @stampwarnings = {}
  nil
end
debug_once(msg) click to toggle source
# File lib/puppet/util/warnings.rb, line 9
def debug_once(msg)
  Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.debug msg }
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 13
def warnonce(msg)
  Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.warning msg }
end

Protected Class Methods

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