Merge branch '7167-keep-rsync-test-setup' into 7167-keep-rsync
[arvados.git] / tools / keep-rsync / keep-rsync.go
index ae76aa8fa73605cc61a30cb659e9c95df81e32f2..fdce662016ab18b758dbcae8af91ce4df5dbf954 100644 (file)
@@ -60,7 +60,7 @@ func main() {
        flag.IntVar(
                &replications,
                "replications",
-               3,
+               0,
                "Number of replications to write to the destination.")
 
        flag.StringVar(
@@ -156,6 +156,16 @@ func initializeKeepRsync() (err error) {
                return
        }
 
+       // Get default replications value from destination, if it is not already provided
+       if replications == 0 {
+               value, err := arvDst.Discovery("defaultCollectionReplication")
+               if err == nil {
+                       replications = int(value.(float64))
+               } else {
+                       replications = 2
+               }
+       }
+
        // if srcKeepServicesJSON is provided, use it to load services; else, use DiscoverKeepServers
        if srcKeepServicesJSON == "" {
                kcSrc, err = keepclient.MakeKeepClient(&arvSrc)