Skip to content

Commit

Permalink
Merge pull request #361 from k3it/main
Browse files Browse the repository at this point in the history
maintain proper formating of the remote paths when defined as user@ho…

…st:/... or host:/...
SUMMARY

update  _format_rsync_rsh_target for proper handling of remote rsh/ssh paths.  fixes #360

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ansible.posix.synchronize

Reviewed-by: Adam Miller <[email protected]>
Reviewed-by: Hideki Saito <[email protected]>
  • Loading branch information
2 parents 52d1408 + 4efdb43 commit 0ed72d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- synchronize - maintain proper formatting of the remote paths (https://github.com/ansible-collections/ansible.posix/pull/361).
9 changes: 8 additions & 1 deletion plugins/action/synchronize.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ def _format_rsync_rsh_target(self, host, path, user):

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):

Expand Down

0 comments on commit 0ed72d0

Please sign in to comment.