-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache_dir_lock
in main
is always None
, so the lockfile never gets cleaned up
#4030
Labels
Comments
Seems legit, a pull-requests would be welcomed. |
guppy0130
added a commit
to guppy0130/ansible-lint
that referenced
this issue
Mar 2, 2024
* in `initialize_options`, we need to update the globally-scoped `cache_dir_lock` so that later on, `main` can release the lock and cleanup the lockfile. Fixes ansible#4030
guppy0130
added a commit
to guppy0130/ansible-lint
that referenced
this issue
Mar 2, 2024
* in `initialize_options`, we need to update the globally-scoped `cache_dir_lock` so that later on, `main` can release the lock and cleanup the lockfile. Fixes ansible#4030
audgirka
pushed a commit
to guppy0130/ansible-lint
that referenced
this issue
Mar 4, 2024
* in `initialize_options`, we need to update the globally-scoped `cache_dir_lock` so that later on, `main` can release the lock and cleanup the lockfile. Fixes ansible#4030
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: