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: Manuel Franceschini <livewire@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
from ganeti import utils
from ganeti import errors
from ganeti import constants
+from ganeti import netutils
def FormatParamikoFingerprint(fingerprint):
command = [constants.SCP, "-p"]
command.extend(self._BuildSshOptions(True, False, True, True))
command.append(filename)
+ if netutils.IP6Address.IsValid(node):
+ node = netutils.FormatAddress((node, None))
+
command.append("%s:%s" % (node, filename))
result = utils.RunCmd(command)