[wip] Troubleshoot tests by dwoz · Pull Request #68727 · saltstack/salt

@dwoz dwoz changed the base branch from master to 3007.x

February 12, 2026 08:56

@dwoz

Add defensive code to handle the case where state_queue.lock or
job_queue.lock exist as directories instead of files. This situation
has been observed in CI tests, though the root cause is unclear.

The fix:
- Changes the check from os.path.isfile() to os.path.exists()
- Handles three cases: file (expected), directory (unexpected), other
- Uses shutil.rmtree() to remove directories
- Adds warning logging when a directory is found to aid debugging
- Improves error handling with specific log messages

This allows the minion to recover from corrupted lock state and
continue operating, while logging information to help identify the
underlying cause.

bdrx312