Skip to content

Commit

Permalink
support ipv6 for scp with none backend
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Sep 14, 2018
1 parent 95853c3 commit cb437f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions nixops/backends/__init__.py
Expand Up @@ -271,7 +271,7 @@ def send_keys(self):
def get_keys(self):
return self.keys

def get_ssh_name(self):
def get_ssh_name(self, scp=False):
assert False

def get_ssh_flags(self, scp=False):
Expand Down Expand Up @@ -390,15 +390,15 @@ def upload_file(self, source, target, recursive=False):
cmdline = ["scp"] + self.get_ssh_flags(True) + master.opts
if recursive:
cmdline += ['-r']
cmdline += [source, "root@" + self.get_ssh_name() + ":" + target]
cmdline += [source, "root@" + self.get_ssh_name(True) + ":" + target]
return self._logged_exec(cmdline)

def download_file(self, source, target, recursive=False):
master = self.ssh.get_master()
cmdline = ["scp"] + self.get_ssh_flags(True) + master.opts
if recursive:
cmdline += ['-r']
cmdline += ["root@" + self.get_ssh_name() + ":" + source, target]
cmdline += ["root@" + self.get_ssh_name(True) + ":" + source, target]
return self._logged_exec(cmdline)

def get_console_output(self):
Expand Down
4 changes: 3 additions & 1 deletion nixops/backends/none.py
Expand Up @@ -67,8 +67,10 @@ def switch_to_configuration(self, method, sync, command=None):
self._ssh_public_key_deployed = True
return res

def get_ssh_name(self):
def get_ssh_name(self, scp=False):
assert self.target_host
if scp and (":" in self.target_host):
return "[%s]" % (self.target_host)
return self.target_host

def get_ssh_private_key_file(self):
Expand Down

0 comments on commit cb437f3

Please sign in to comment.