Skip to content

Commit

Permalink
rsync: cmd: enclose IPv6 hosts in brackets
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Villaro-Dixon <frank.villaro@infomaniak.com>
  • Loading branch information
Frankkkkk committed Aug 16, 2021
1 parent 41738bb commit 9e9659b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/rsync/rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"strings"
"github.com/utkuozdemir/pv-migrate/internal/k8s"
"github.com/utkuozdemir/pv-migrate/internal/pvc"
"github.com/utkuozdemir/pv-migrate/internal/task"
Expand Down Expand Up @@ -68,6 +69,12 @@ type script struct {

func BuildRsyncScript(deleteExtraneousFiles bool, noChown bool,
sshTargetHost string, sourcePath string, destPath string) (string, error) {

if strings.Count(sshTargetHost, ":") >= 2 {
//Rsync needs IPv6 host in brackets
sshTargetHost = "[" + sshTargetHost + "]"
}

s := script{
MaxRetries: maxRetries,
DeleteExtraneousFiles: deleteExtraneousFiles,
Expand Down

0 comments on commit 9e9659b

Please sign in to comment.