| Server IP : 77.68.64.21 / Your IP : 216.73.217.59 Web Server : Apache System : Linux hp3-wp-1011352.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els9.x86_64 #1 SMP Fri Jul 10 17:06:31 UTC 2026 x86_64 User : csh2516497 ( 2094697) PHP Version : 8.3.30 Disable Function : shell_exec,exec,system,popen,set_time_limit MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/ruby/vendor_ruby/puppet/agent/ |
Upload File : |
require 'puppet/util/pidlock'
# This module is responsible for encapsulating the logic for "locking" the
# puppet agent during a catalog run; in other words, keeping track of enough
# state to answer the question "is there a puppet agent currently applying a
# catalog?"
#
# 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_path
@lockfile_path ||= Puppet[:agent_catalog_run_lockfile]
end
def lockfile
@lockfile ||= Puppet::Util::Pidlock.new(lockfile_path)
@lockfile
end
private :lockfile
end