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
24 def self.maybe_log(message, klass)
25   @stampwarnings ||= {}
26   @stampwarnings[klass] ||= []
27   return nil if @stampwarnings[klass].include? message
28   yield
29   @stampwarnings[klass] << message
30   nil
31 end

Public Instance Methods

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