maintain proper formating of the remote paths when defined as user@host:/... or host:/...

* fixes #360
This commit is contained in:
k3it 2022-05-14 15:16:03 -04:00 committed by Hideki Saito
parent 45519c68be
commit 4efdb43ccd
No known key found for this signature in database
GPG key ID: 3E1D43AA010AC50A
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361).

View file

@ -77,7 +77,14 @@ class ActionModule(ActionBase):
if self._host_is_ipv6_address(host):
return '[%s%s]:%s' % (user_prefix, host, path)
return '%s%s:%s' % (user_prefix, host, path)
# preserve formatting of remote paths if host or user@host is explicitly defined in the path
if ':' not in path:
return '%s%s:%s' % (user_prefix, host, path)
elif '@' not in path:
return '%s%s' % (user_prefix, path)
else:
return path
def _process_origin(self, host, path, user):