cache_dir_lock
in main
is always None
, so the lockfile never gets cleaned up
#4030
Labels
cache_dir_lock
in main
is always None
, so the lockfile never gets cleaned up
#4030
Summary
cache_dir_lock
is initialized asNone
here, in the global scope I believe:ansible-lint/src/ansiblelint/__main__.py
Line 82 in 7849f27
In
initialize_options
, a new, frame-onlycache_dir_lock
is created here:ansible-lint/src/ansiblelint/__main__.py
Lines 148 to 152 in 7849f27
I think pylint was correct to indicate that the global name was redefined. This variable isn't marked as
global
and so thecache_dir_lock
ininitialize_options
is local toinitialize_options
only.The value of
cache_dir_lock
(theglobal
one) is stillNone
later on, so this conditional is always falsy and the lockfile therefore never gets cleaned up:ansible-lint/src/ansiblelint/__main__.py
Lines 380 to 382 in 7849f27
I believe this behavior is introduced by c6bd9a7.
I'd love to PR to resolve this, but I don't know if you prefer the
global
approach or just returning the lock frominitialize_options
.Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
In one session
and in another session
watch the lockfile get created when
ansible-lint
is run, and then it shouldn't get cleaned up.Desired Behavior
The
cache_dir_lock
thatmain
uses is notNone
, either by theglobal
keyword orinitialize_options
returning it to its caller,main
; in which case, the lock can be correctly cleaned up after ansible-lint finishes.Actual Behavior
Ansible-lint doesn't clean up the lockfile, because
cache_dir_lock
isNone
inmain
.Please give some details of what is happening. Include a minimum complete
verifiable example with:
The text was updated successfully, but these errors were encountered: