1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses.

This commit is contained in:
Petr Mifek 2015-09-17 23:19:11 +02:00
parent cc6627cdd6
commit 6f3f4dff7a

View file

@ -47,10 +47,13 @@ class ActionModule(ActionBase):
def _process_origin(self, host, path, user): def _process_origin(self, host, path, user):
if host not in C.LOCALHOST: if host not in C.LOCALHOST:
userPart = ''
if user: if user:
return '%s@[%s]:%s' % (user, host, path) userPart = '%s@' % (user, )
if ":" in host:
return '[%s%s]:%s' % (userPart, host, path)
else: else:
return '[%s]:%s' % (host, path) return '%s%s:%s' % (userPart, host, path)
if ':' not in path and not path.startswith('/'): if ':' not in path and not path.startswith('/'):
path = self._get_absolute_path(path=path) path = self._get_absolute_path(path=path)
@ -59,10 +62,13 @@ class ActionModule(ActionBase):
def _process_remote(self, host, path, user): def _process_remote(self, host, path, user):
transport = self._play_context.connection transport = self._play_context.connection
if host not in C.LOCALHOST or transport != "local": if host not in C.LOCALHOST or transport != "local":
userPart = ''
if user: if user:
return '%s@[%s]:%s' % (user, host, path) userPart = '%s@' % (user, )
if ":" in host:
return '[%s%s]:%s' % (userPart, host, path)
else: else:
return '[%s]:%s' % (host, path) return '%s%s:%s' % (userPart, host, path)
if ':' not in path and not path.startswith('/'): if ':' not in path and not path.startswith('/'):
path = self._get_absolute_path(path=path) path = self._get_absolute_path(path=path)