1
mirror of https://github.com/rclone/rclone synced 2024-11-12 10:50:08 +01:00

test_all: fix run with -remotes that aren't in the config file

This commit is contained in:
Nick Craig-Wood 2019-01-10 10:59:32 +00:00
parent 0ec6dd9f4b
commit 2e6ef4f6ec

View File

@ -9,6 +9,7 @@ import (
"log" "log"
"path" "path"
"github.com/ncw/rclone/fs"
"github.com/pkg/errors" "github.com/pkg/errors"
yaml "gopkg.in/yaml.v2" yaml "gopkg.in/yaml.v2"
) )
@ -119,7 +120,12 @@ func (c *Config) filterBackendsByRemotes(remotes []string) {
} }
if !found { if !found {
log.Printf("Remote %q not found - inserting with default flags", name) log.Printf("Remote %q not found - inserting with default flags", name)
newBackends = append(newBackends, Backend{Remote: name}) // Lookup which backend
fsInfo, _, _, _, err := fs.ConfigFs(name)
if err != nil {
log.Fatalf("couldn't find remote %q: %v", name, err)
}
newBackends = append(newBackends, Backend{Backend: fsInfo.FileName(), Remote: name})
} }
} }
c.Backends = newBackends c.Backends = newBackends