summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Mifek <petr.mifek@anapol.cz>2015-09-17 23:19:11 +0200
committerPetr Mifek <petr.mifek@anapol.cz>2015-09-17 23:19:11 +0200
commit6f3f4dff7a5ae0b69a7d738c83f7a74c7a946d70 (patch)
tree75f88649b4121778e1803c777d5f93b10d8499dc
parentcc6627cdd63552fe9a2158065fb5cf5e7540c4e4 (diff)
downloadansible-6f3f4dff7a5ae0b69a7d738c83f7a74c7a946d70.tar.gz
Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses.
-rw-r--r--lib/ansible/plugins/action/synchronize.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py
index f9a4b49bb7..cb36d9c485 100644
--- a/lib/ansible/plugins/action/synchronize.py
+++ b/lib/ansible/plugins/action/synchronize.py
@@ -47,10 +47,13 @@ class ActionModule(ActionBase):
def _process_origin(self, host, path, user):
if host not in C.LOCALHOST:
+ userPart = ''
if user:
- return '%s@[%s]:%s' % (user, host, path)
+ userPart = '%s@' % (user, )
+ if ":" in host:
+ return '[%s%s]:%s' % (userPart, host, path)
else:
- return '[%s]:%s' % (host, path)
+ return '%s%s:%s' % (userPart, host, path)
if ':' not in path and not path.startswith('/'):
path = self._get_absolute_path(path=path)
@@ -59,10 +62,13 @@ class ActionModule(ActionBase):
def _process_remote(self, host, path, user):
transport = self._play_context.connection
if host not in C.LOCALHOST or transport != "local":
+ userPart = ''
if user:
- return '%s@[%s]:%s' % (user, host, path)
+ userPart = '%s@' % (user, )
+ if ":" in host:
+ return '[%s%s]:%s' % (userPart, host, path)
else:
- return '[%s]:%s' % (host, path)
+ return '%s%s:%s' % (userPart, host, path)
if ':' not in path and not path.startswith('/'):
path = self._get_absolute_path(path=path)