Salt-SSH deal with raw IPv6 addresses

This commit is contained in:
Ronald van Zantvoort 2017-01-19 21:07:35 +01:00
parent 878946d0f8
commit dd1223468b

View file

@ -66,7 +66,8 @@ class Shell(object):
sudo_user=None,
remote_port_forwards=None):
self.opts = opts
self.host = host
# ssh <ipv6>, but scp [<ipv6]:/path
self.host = host.strip('[]')
self.user = user
self.port = port
self.passwd = str(passwd) if passwd else passwd
@ -320,6 +321,10 @@ class Shell(object):
if makedirs:
self.exec_cmd('mkdir -p {0}'.format(os.path.dirname(remote)))
# scp needs [<ipv6}
if ':' in self.host:
self.host = '[{0}]'.format(self.host)
cmd = '{0} {1}:{2}'.format(local, self.host, remote)
cmd = self._cmd_str(cmd, ssh='scp')