diff --git a/CHANGELOG.md b/CHANGELOG.md index b70b979b..5b75bcd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ ## +- **CHANGED** For multi-source downsync/get the separator for paths is changed to | to avoid problems with path that contains spaces +- **FIXED** Network paths with spaces in them don't work - #252 + +## v0.4.2 - **FIXED** Networks share paths that starts with \\ no longer need to be manually escaped (fixes https://github.com/DanEngelbrecht/golongtail/issues/249) - **UPDATED** Update longtaillib to v0.4.2 diff --git a/commands/cmd_downsync_test.go b/commands/cmd_downsync_test.go index c7725900..c0a66da6 100644 --- a/commands/cmd_downsync_test.go +++ b/commands/cmd_downsync_test.go @@ -316,7 +316,7 @@ func TestMultiVersionDownsync(t *testing.T) { executeCommandLine("upsync", "--include-filter-regex", ".*/$**.*\\.layer2$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer2.lvi", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer2.lsi") executeCommandLine("upsync", "--include-filter-regex", ".*/$**.*\\.layer3$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer3.lvi", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer3.lsi") - cmd, err := executeCommandLine("downsync", "--source-path", fsBlobPathPrefix+"/index/base.lvi "+fsBlobPathPrefix+"/index/layer2.lvi "+fsBlobPathPrefix+"/index/layer3.lvi", "--target-path", testPath+"/target", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/base.lsi "+fsBlobPathPrefix+"/index/layer2.lsi "+fsBlobPathPrefix+"/index/layer3.lsi") + cmd, err := executeCommandLine("downsync", "--source-path", fsBlobPathPrefix+"/index/base.lvi|"+fsBlobPathPrefix+"/index/layer2.lvi|"+fsBlobPathPrefix+"/index/layer3.lvi", "--target-path", testPath+"/target", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/base.lsi|"+fsBlobPathPrefix+"/index/layer2.lsi|"+fsBlobPathPrefix+"/index/layer3.lsi") if err != nil { t.Errorf("%s: %s", cmd, err) } diff --git a/commands/cmd_get.go b/commands/cmd_get.go index 698c90e6..f8bace90 100644 --- a/commands/cmd_get.go +++ b/commands/cmd_get.go @@ -130,7 +130,7 @@ func get( } type GetCmd struct { - GetConfigURIs []string `name:"source-path" help:"File uri(s) for json formatted get-config file" required:"" sep:" "` + GetConfigURIs []string `name:"source-path" help:"File uri(s) for json formatted get-config file" required:"" sep:"|"` S3EndpointResolverURLOption TargetPathOption TargetIndexUriOption diff --git a/commands/cmd_get_test.go b/commands/cmd_get_test.go index 5abb958f..a39ebc49 100644 --- a/commands/cmd_get_test.go +++ b/commands/cmd_get_test.go @@ -115,7 +115,7 @@ func TestMultiVersionGet(t *testing.T) { executeCommandLine("put", "--include-filter-regex", ".*/$**.*\\.layer2$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer2.json", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer2.lsi") executeCommandLine("put", "--include-filter-regex", ".*/$**.*\\.layer3$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer3.json", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer3.lsi") - cmd, err := executeCommandLine("get", "--source-path", fsBlobPathPrefix+"/index/base.json "+fsBlobPathPrefix+"/index/layer2.json "+fsBlobPathPrefix+"/index/layer3.json", "--target-path", testPath+"/target") + cmd, err := executeCommandLine("get", "--source-path", fsBlobPathPrefix+"/index/base.json|"+fsBlobPathPrefix+"/index/layer2.json|"+fsBlobPathPrefix+"/index/layer3.json" , "--target-path", testPath+"/target") if err != nil { t.Errorf("%s: %s", cmd, err) } @@ -130,7 +130,7 @@ func TestMultiVersionGetMismatchStoreURI(t *testing.T) { executeCommandLine("put", "--include-filter-regex", ".*/$**.*\\.layer2$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer2.json", "--storage-uri", fsBlobPathPrefix+"/storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer2.lsi") executeCommandLine("put", "--include-filter-regex", ".*/$**.*\\.layer3$", "--source-path", testPath+"/source", "--target-path", fsBlobPathPrefix+"/index/layer3.json", "--storage-uri", fsBlobPathPrefix+"/bad_storage", "--version-local-store-index-path", fsBlobPathPrefix+"/index/layer3.lsi") - cmd, err := executeCommandLine("get", "--source-path", fsBlobPathPrefix+"/index/base.json "+fsBlobPathPrefix+"/index/layer2.json "+fsBlobPathPrefix+"/index/layer3.json", "--target-path", testPath+"/target") + cmd, err := executeCommandLine("get", "--source-path", fsBlobPathPrefix+"/index/base.json|"+fsBlobPathPrefix+"/index/layer2.json|"+fsBlobPathPrefix+"/index/layer3.json", "--target-path", testPath+"/target") if err == nil { t.Errorf("%s: %s", cmd, err) } diff --git a/commands/commands_test.go b/commands/commands_test.go index 6c222bce..6c1b817e 100644 --- a/commands/commands_test.go +++ b/commands/commands_test.go @@ -8,11 +8,20 @@ import ( "github.com/DanEngelbrecht/golongtail/longtailstorelib" "github.com/alecthomas/kong" + "github.com/sirupsen/logrus" ) func executeCommandLine(command string, params ...string) (string, error) { + log := logrus.WithFields(logrus.Fields{ + "command": command, + "params": params, + }) + args := []string{command} args = append(args, params...) + + log.Info("++++++ running command") + // args := strings.Split(commandLine, " ") parser, err := kong.New(&Cli) if err != nil { diff --git a/commands/options.go b/commands/options.go index 819029f8..5e8bdba8 100644 --- a/commands/options.go +++ b/commands/options.go @@ -61,7 +61,7 @@ type SourceUriOption struct { } type MultiSourceUrisOption struct { - SourcePaths []string `name:"source-path" help:"Source file uri(s)" required:"" sep:" "` + SourcePaths []string `name:"source-path" help:"Source file uri(s)" required:"" sep:"|"` } type ValidateTargetOption struct { @@ -73,7 +73,7 @@ type VersionLocalStoreIndexPathOption struct { } type MultiVersionLocalStoreIndexPathsOption struct { - VersionLocalStoreIndexPaths []string `name:"version-local-store-index-path" help:"Path(s) to an optimized store index matching the source. If any of the file(s) cant be read it will fall back to the master store index" sep:" "` + VersionLocalStoreIndexPaths []string `name:"version-local-store-index-path" help:"Path(s) to an optimized store index matching the source. If any of the file(s) cant be read it will fall back to the master store index" sep:"|"` } type VersionIndexPathOption struct {