Commit 8062638d authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

Fix scp command when target is an IPv6 address



Due to the syntax used for the target in scp <target>:<path>, it is
necessary when the target is an IPv6 address to enclose it in square
brackets.
Signed-off-by: default avatarManuel Franceschini <livewire@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 338180f5
...@@ -31,6 +31,7 @@ import re ...@@ -31,6 +31,7 @@ import re
from ganeti import utils from ganeti import utils
from ganeti import errors from ganeti import errors
from ganeti import constants from ganeti import constants
from ganeti import netutils
def FormatParamikoFingerprint(fingerprint): def FormatParamikoFingerprint(fingerprint):
...@@ -220,6 +221,9 @@ class SshRunner: ...@@ -220,6 +221,9 @@ class SshRunner:
command = [constants.SCP, "-p"] command = [constants.SCP, "-p"]
command.extend(self._BuildSshOptions(True, False, True, True)) command.extend(self._BuildSshOptions(True, False, True, True))
command.append(filename) command.append(filename)
if netutils.IP6Address.IsValid(node):
node = netutils.FormatAddress((node, None))
command.append("%s:%s" % (node, filename)) command.append("%s:%s" % (node, filename))
result = utils.RunCmd(command) result = utils.RunCmd(command)
......
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