Commit 6f3f4dff by Petr Mifek

Change synchronize module plugin to be backwards compatible with RSync 2.6.9…

Change synchronize module plugin to be backwards compatible with RSync 2.6.9 with regard to handling IPv6 addresses.
parent cc6627cd
...@@ -47,10 +47,13 @@ class ActionModule(ActionBase): ...@@ -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): ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment