Commit 82c80697 by James Cammarata Committed by Michael DeHaan

Only use LOG_LOCK in log_flock if a runner is not specified

Fixes issue #3466 - When ansible can't authenticate against a host,
and your answer is no, ansible crash.
parent f7723651
......@@ -84,22 +84,31 @@ def log_lockfile():
LOG_LOCK = open(log_lockfile(), 'w')
def log_flock(runner):
fcntl.lockf(LOG_LOCK, fcntl.LOCK_EX)
if runner is not None:
try:
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_EX)
except OSError:
# already got closed?
pass
else:
try:
fcntl.lockf(LOG_LOCK, fcntl.LOCK_EX)
except OSError:
pass
def log_unflock(runner):
fcntl.lockf(LOG_LOCK, fcntl.LOCK_UN)
if runner is not None:
try:
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_UN)
except OSError:
# already got closed?
pass
else:
try:
fcntl.lockf(LOG_LOCK, fcntl.LOCK_UN)
except OSError:
pass
def set_play(callback, play):
''' used to notify callback plugins of context '''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment