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 3f18f74
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 @@ -11,6 +11,7 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strings"
)

const (
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 3f18f74

Please sign in to comment.