-
Notifications
You must be signed in to change notification settings - Fork 24k
Throw LockFailedException if apt cmd encounters a lock file #81754
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
base: devel
Are you sure you want to change the base?
Conversation
The test
The test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PR, are you able to create a changelog fragment for this bugfix as per https://docs.ansible.com/ansible/latest/community/development_process.html#creating-changelog-fragments. It would also be great to have an integration test for at least some of the scenarios, it could potentially be done by having an async
task that locks the file while you then run a normal task that expects the lock to be there and fail after the timeout.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
SUMMARY
Fixes #78658
ISSUE TYPE
ADDITIONAL INFORMATION
An earlier attempt (#78658) to fix this issue didn't work for me because because
DPkg::Lock::Timeout
is anapt
parameter not adpkg
one.The code supports the
lock_timeout
parameter but the problem here is that the when the lock issue is encountered, the code subsequently runsm.fail_json
which then callssys.exit
and this bypasses theexcept apt.cache.LockFailedException
handler so the cmd is never re-tried.I'm sure there are better solutions to this issue but I'm raising this PR here just in case others want to use this solution by overriding apt.py locally.