Move nested function test for ipv6 to top level in synchronize module.
This commit is contained in:
parent
27f779a7cc
commit
6e035a3e94
1 changed files with 4 additions and 4 deletions
|
@ -44,17 +44,17 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def _host_is_ipv6_address(self, host):
|
||||||
|
return ':' in host
|
||||||
|
|
||||||
def _format_rsync_rsh_target(self, host, path, user):
|
def _format_rsync_rsh_target(self, host, path, user):
|
||||||
''' formats rsync rsh target, escaping ipv6 addresses if needed '''
|
''' formats rsync rsh target, escaping ipv6 addresses if needed '''
|
||||||
|
|
||||||
def _needs_ipv6_brackets(host):
|
|
||||||
return ':' in host
|
|
||||||
|
|
||||||
user_prefix = ''
|
user_prefix = ''
|
||||||
if user:
|
if user:
|
||||||
user_prefix = '%s@' % (user, )
|
user_prefix = '%s@' % (user, )
|
||||||
|
|
||||||
if _needs_ipv6_brackets(host):
|
if self._host_is_ipv6_address(host):
|
||||||
return '[%s%s]:%s' % (user_prefix, host, path)
|
return '[%s%s]:%s' % (user_prefix, host, path)
|
||||||
else:
|
else:
|
||||||
return '%s%s:%s' % (user_prefix, host, path)
|
return '%s%s:%s' % (user_prefix, host, path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue