module Puppet::Util::Warnings

Methods to help with handling warnings.

Public Class Methods

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

Public Instance Methods

clear_warnings() click to toggle source
   # File lib/puppet/util/warnings.rb
18 def clear_warnings
19   @stampwarnings = {}
20   nil
21 end
debug_once(msg) click to toggle source
   # File lib/puppet/util/warnings.rb
 9 def debug_once(msg)
10   return nil unless Puppet[:debug]
11   Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.debug msg }
12 end
notice_once(msg) click to toggle source
  # File lib/puppet/util/warnings.rb
5 def notice_once(msg)
6   Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.notice msg }
7 end
warnonce(msg) click to toggle source
   # File lib/puppet/util/warnings.rb
14 def warnonce(msg)
15   Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.warning msg }
16 end