mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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:
parent
f7723651d3
commit
82c806979b
1 changed files with 11 additions and 2 deletions
|
@ -84,22 +84,31 @@ def log_lockfile():
|
||||||
LOG_LOCK = open(log_lockfile(), 'w')
|
LOG_LOCK = open(log_lockfile(), 'w')
|
||||||
|
|
||||||
def log_flock(runner):
|
def log_flock(runner):
|
||||||
fcntl.lockf(LOG_LOCK, fcntl.LOCK_EX)
|
|
||||||
if runner is not None:
|
if runner is not None:
|
||||||
try:
|
try:
|
||||||
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_EX)
|
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_EX)
|
||||||
except OSError:
|
except OSError:
|
||||||
# already got closed?
|
# already got closed?
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
fcntl.lockf(LOG_LOCK, fcntl.LOCK_EX)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def log_unflock(runner):
|
def log_unflock(runner):
|
||||||
fcntl.lockf(LOG_LOCK, fcntl.LOCK_UN)
|
|
||||||
if runner is not None:
|
if runner is not None:
|
||||||
try:
|
try:
|
||||||
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_UN)
|
fcntl.lockf(runner.output_lockfile, fcntl.LOCK_UN)
|
||||||
except OSError:
|
except OSError:
|
||||||
# already got closed?
|
# already got closed?
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
fcntl.lockf(LOG_LOCK, fcntl.LOCK_UN)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
def set_play(callback, play):
|
def set_play(callback, play):
|
||||||
''' used to notify callback plugins of context '''
|
''' used to notify callback plugins of context '''
|
||||||
|
|
Loading…
Reference in a new issue