diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-13 16:11:08 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-13 16:11:08 +0000 |
| commit | 0c0936be7cf6b02c11ce931fd2b830392bfc2329 (patch) | |
| tree | e15b437afcc7d905a510365b2e9881ca0e9a597d /lib | |
| parent | af1de894bcb5afcba2976ad4e8c7ebb2a789f240 (diff) | |
| download | puppet-0c0936be7cf6b02c11ce931fd2b830392bfc2329.tar.gz puppet-0c0936be7cf6b02c11ce931fd2b830392bfc2329.tar.xz puppet-0c0936be7cf6b02c11ce931fd2b830392bfc2329.zip | |
Adding a module for helping with warnings, starting only with the "warnonce" method
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1578 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/util.rb | 1 | ||||
| -rw-r--r-- | lib/puppet/util/warnings.rb | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index c16d87029..e91ea0156 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -523,5 +523,6 @@ require 'puppet/util/classgen' require 'puppet/util/docs' require 'puppet/util/execution' require 'puppet/util/package' +require 'puppet/util/warnings' # $Id$ diff --git a/lib/puppet/util/warnings.rb b/lib/puppet/util/warnings.rb new file mode 100644 index 000000000..1d84c2732 --- /dev/null +++ b/lib/puppet/util/warnings.rb @@ -0,0 +1,15 @@ +# Methods to help with handling warnings. +module Puppet::Util::Warnings + module_function + + def warnonce(msg) + $stampwarnings ||= {} + $stampwarnings[self.class] ||= [] + unless $stampwarnings[self.class].include? msg + warning msg + $stampwarnings[self.class] << msg + end + end +end + +# $Id$ |
