mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-08-01 04:14:46 +00:00
Merge pull request #118 from pneerincx/bugfix_for_17492
Bugfix for #17492 "Do not prepend PWD when path is in form user@server:path or server:path" Reviewed-by: https://github.com/apps/ansible-zuul
This commit is contained in:
@@ -33,7 +33,13 @@ class ActionModule(ActionBase):
|
|||||||
def _get_absolute_path(self, path):
|
def _get_absolute_path(self, path):
|
||||||
original_path = path
|
original_path = path
|
||||||
|
|
||||||
if path.startswith('rsync://'):
|
#
|
||||||
|
# Check if we have a local relative path and do not process
|
||||||
|
# * remote paths (some.server.domain:/some/remote/path/...)
|
||||||
|
# * URLs (rsync://...)
|
||||||
|
# * local absolute paths (/some/local/path/...)
|
||||||
|
#
|
||||||
|
if ':' in path or path.startswith('/'):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
if self._task._role is not None:
|
if self._task._role is not None:
|
||||||
@@ -73,7 +79,6 @@ class ActionModule(ActionBase):
|
|||||||
if host not in C.LOCALHOST:
|
if host not in C.LOCALHOST:
|
||||||
return self._format_rsync_rsh_target(host, path, user)
|
return self._format_rsync_rsh_target(host, path, user)
|
||||||
|
|
||||||
if ':' not in path and not path.startswith('/'):
|
|
||||||
path = self._get_absolute_path(path=path)
|
path = self._get_absolute_path(path=path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@@ -103,7 +108,6 @@ class ActionModule(ActionBase):
|
|||||||
task_args['_substitute_controller'] = True
|
task_args['_substitute_controller'] = True
|
||||||
return self._format_rsync_rsh_target(host, path, user)
|
return self._format_rsync_rsh_target(host, path, user)
|
||||||
|
|
||||||
if ':' not in path and not path.startswith('/'):
|
|
||||||
path = self._get_absolute_path(path=path)
|
path = self._get_absolute_path(path=path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@@ -348,9 +352,7 @@ class ActionModule(ActionBase):
|
|||||||
else:
|
else:
|
||||||
# Still need to munge paths (to account for roles) even if we aren't
|
# Still need to munge paths (to account for roles) even if we aren't
|
||||||
# copying files between hosts
|
# copying files between hosts
|
||||||
if not src.startswith('/'):
|
|
||||||
src = self._get_absolute_path(path=src)
|
src = self._get_absolute_path(path=src)
|
||||||
if not dest.startswith('/'):
|
|
||||||
dest = self._get_absolute_path(path=dest)
|
dest = self._get_absolute_path(path=dest)
|
||||||
|
|
||||||
_tmp_args['src'] = src
|
_tmp_args['src'] = src
|
||||||
|
|||||||
Reference in New Issue
Block a user