Sha256: 5b81c68f07380302f927ff0b11043df681ec354c904d5bbf0ea3557874fd8ac0
Contents?: true
Size: 750 Bytes
Versions: 20
Compression:
Stored size: 750 Bytes
Contents
# frozen_string_literal: true # 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 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
20 entries across 20 versions & 1 rubygems