-
Notifications
You must be signed in to change notification settings - Fork 654
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
fix: deterministic behaviour of cache installation in prerun #1660
Conversation
@xabinapal I see you have two open PRs that seem to address the same bug. Can you close one? |
There are several problems with this change:
Keep in mind that we should avoid using |
The symlink function was a refactor of already existing code that was duplicated twice, just to enforce DRY: https://github.com/ansible-community/ansible-lint/blob/master/src/ansiblelint/prerun.py#L409-L412 and https://github.com/ansible-community/ansible-lint/blob/master/src/ansiblelint/prerun.py#L295-L298 I changed it a little bit to check if def _symlink_galaxy_install(link_path: pathlib.Path) -> None:
"""Helper function to symlink project directory in a custom location"""
target = str(pathlib.Path(options.project_dir).absolute())
try:
if os.readlink(str(link_path.absolute())) != target:
link_path.unlink()
else:
return
except FileNotFoundError:
pass
except OSError:
raise RuntimeError(
"Can't replace non-symlink path '%s'" % link_path.absolute()
) from None
link_path.symlink_to(target, target_is_directory=True) Regarding the usage of On the other hand, I don’t really understand what you mean with the second problem. I’ve not changed neither the |
I need to close this because it is in direct conflict with #1666 as we are moving all the bootstraping of the testing environment out of the linter, so we can use it with molecule and also to enable use of execution environments. If the problem is still valid after we make this change, we will have to alter ansible-compat library. |
Ensure cache directory and environment are populated from
project_dir
and not from current working directory inprerun
process.Fixes: #1654