Sha256: ae7329c978f3b85cf3ab2d30f52e345f7e92a54c4f301a0a61226978263418fa
Contents?: true
Size: 1018 Bytes
Versions: 2
Compression:
Stored size: 1018 Bytes
Contents
require 'puppet/util/pidlock' # This module is responsible for encapsulating the logic for # "locking" the puppet agent during a run; in other words, # keeping track of enough state to answer the question # "is there a puppet agent currently running?" # # The implementation involves writing a lockfile whose contents # are simply the PID of the running agent process. This is # considered part of the public Puppet API because it used # by external tools such as mcollective. # # For more information, please see docs on the website. # http://links.puppetlabs.com/agent_lockfiles module Puppet::Agent::Locker # Yield if we get a lock, else do nothing. Return # true/false depending on whether we get the lock. def lock if lockfile.lock begin yield ensure lockfile.unlock end end end def running? lockfile.locked? end def lockfile @lockfile ||= Puppet::Util::Pidlock.new(Puppet[:agent_pidfile]) @lockfile end private :lockfile end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-3.0.0.rc5 | lib/puppet/agent/locker.rb |
puppet-3.0.0.rc4 | lib/puppet/agent/locker.rb |