|
@@ -15,6 +15,7 @@ type rsyncConfig struct {
|
|
upstreamURL, username, password, excludeFile string
|
|
upstreamURL, username, password, excludeFile string
|
|
extraOptions []string
|
|
extraOptions []string
|
|
overriddenOptions []string
|
|
overriddenOptions []string
|
|
|
|
+ useOverrideOnly bool
|
|
rsyncNeverTimeout bool
|
|
rsyncNeverTimeout bool
|
|
rsyncTimeoutValue int
|
|
rsyncTimeoutValue int
|
|
rsyncEnv map[string]string
|
|
rsyncEnv map[string]string
|
|
@@ -75,25 +76,31 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
|
|
options = c.overriddenOptions
|
|
options = c.overriddenOptions
|
|
}
|
|
}
|
|
|
|
|
|
- if !c.rsyncNeverTimeout {
|
|
|
|
- timeo := 120
|
|
|
|
- if c.rsyncTimeoutValue > 0 {
|
|
|
|
- timeo = c.rsyncTimeoutValue
|
|
|
|
|
|
+ if c.useOverrideOnly == true {
|
|
|
|
+ if c.overriddenOptions == nil {
|
|
|
|
+ return nil, errors.New("rsync_override_only is set but no rsync_override provided")
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if !c.rsyncNeverTimeout {
|
|
|
|
+ timeo := 120
|
|
|
|
+ if c.rsyncTimeoutValue > 0 {
|
|
|
|
+ timeo = c.rsyncTimeoutValue
|
|
|
|
+ }
|
|
|
|
+ options = append(options, fmt.Sprintf("--timeout=%d", timeo))
|
|
}
|
|
}
|
|
- options = append(options, fmt.Sprintf("--timeout=%d", timeo))
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if c.useIPv6 {
|
|
|
|
- options = append(options, "-6")
|
|
|
|
- } else if c.useIPv4 {
|
|
|
|
- options = append(options, "-4")
|
|
|
|
- }
|
|
|
|
|
|
+ if c.useIPv6 {
|
|
|
|
+ options = append(options, "-6")
|
|
|
|
+ } else if c.useIPv4 {
|
|
|
|
+ options = append(options, "-4")
|
|
|
|
+ }
|
|
|
|
|
|
- if c.excludeFile != "" {
|
|
|
|
- options = append(options, "--exclude-from", c.excludeFile)
|
|
|
|
- }
|
|
|
|
- if c.extraOptions != nil {
|
|
|
|
- options = append(options, c.extraOptions...)
|
|
|
|
|
|
+ if c.excludeFile != "" {
|
|
|
|
+ options = append(options, "--exclude-from", c.excludeFile)
|
|
|
|
+ }
|
|
|
|
+ if c.extraOptions != nil {
|
|
|
|
+ options = append(options, c.extraOptions...)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
provider.options = options
|
|
provider.options = options
|
|
|
|
|