mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
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.
This commit is contained in:
committed by
Michael DeHaan
parent
f7723651d3
commit
82c806979b
@@ -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 '''
|
||||
|
||||
Reference in New Issue
Block a user