diff options
Diffstat (limited to 'lib/puppet/util.rb')
-rw-r--r-- | lib/puppet/util.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index e5179a587..ec9b6e1fe 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -85,6 +85,16 @@ module Util return retval end + # Create a lock file while something is happening + def self.lock(file) + lock = file + ".lock" + while File.exists?(lock) + Puppet.debug "%s is locked" % file + sleep 0.1 + end + yield + end + # Create instance methods for each of the log levels. This allows # the messages to be a little richer. Most classes will be calling this # method. |