Bugfix for #17492 "Do not prepend PWD when path is in form user@server:path or server:path" #118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This fixes the old bug #17492: "Do not prepend PWD when path is in form user@server:path or server:path" (again).
Fix was already in the ansible/ansible repo pull request 33998 as of December 2017, but never got merged.
There are several instances where the
_get_absolute_path
function is called. This should only happen for relative paths on a local file system and henceThe synchronize.py plugin checked before calling this function whether it was necessary to call
_get_absolute_path
.It should not convert a path to an absolute path when it:
In some cases the code would perform both checks and in some it failed to check for remote paths. This results in ${PWD} getting prepended to the remote path leading to something like /path/to/PWD/user@server:/path/to/what/needs/to/be/synced.
In this pull request the the two checks for remote paths and absolute paths are relocated to the
_get_absolute_path
function to remove code redundancy and to ensure the paths are always checked before trying to convert a local relative path into an absolute one.ISSUE TYPE
COMPONENT NAME
synchronize plugin
ADDITIONAL INFORMATION
Bug happens when using synchronize in
pull
mode. E.g.will fail in any Ansible version with something like: