Skip to content

Commit 7f85d0d

Browse files
committed
[#42131657] Update lock path for Puppet 3.x
Puppet 3.x now uses separate lock files for "running" and "disabled": http://docs.puppetlabs.com/puppet/3/reference/whats_new.html#changes-to-agent-lockfile-behavior I did test using `puppet agent --configprint` to fetch the value. However it doubles the runtime for this simple operation. Similarly, I tried maintaining compat with Puppet 2.7, but it was slow and a terrible mess of conditional Bash. This will break compat with Puppet 2.7 -- which should only be in staging/prod for the next couple of days. Nagios will however continue to report freshness checks.
1 parent 7e0d73a commit 7f85d0d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

puppet.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ def enable():
2121
@task
2222
def check_disabled():
2323
"""Check if puppet runs are disabled"""
24-
lockfile = '/var/lib/puppet/state/puppetdlock'
24+
lockfile = '/var/lib/puppet/state/agent_disabled.lock'
2525

26-
# Puppet is disabled if the lockfile exists and has zero size (whereas a
27-
# running puppet agent will write its PID to the lockfile)
2826
with hide('running'):
29-
run('test -e {0} -a ! -s {0} && echo DISABLED || echo ENABLED'.format(lockfile))
27+
run('test -f {0} && echo DISABLED || echo ENABLED'.format(lockfile))
3028

3129
@task
3230
def dryrun(*args):

0 commit comments

Comments
 (0)