diff --git a/cmd/camput/files.go b/cmd/camput/files.go index 7d6f2dd17..fa07ff89e 100644 --- a/cmd/camput/files.go +++ b/cmd/camput/files.go @@ -156,7 +156,11 @@ func (c *fileCmd) RunCommand(up *Uploader, args []string) error { } for _, filename := range args { - if fi, err := os.Stat(filename); err == nil && fi.IsDir() { + fi, err := os.Stat(filename) + if err != nil { + return err + } + if fi.IsDir() { t := up.NewTreeUpload(filename) t.Start() lastPut, err = t.Wait() diff --git a/pkg/blobserver/remote/remote.go b/pkg/blobserver/remote/remote.go index 37da4bb7d..3b2e824ad 100644 --- a/pkg/blobserver/remote/remote.go +++ b/pkg/blobserver/remote/remote.go @@ -55,7 +55,14 @@ func newFromConfig(_ blobserver.Loader, config jsonconfig.Obj) (storage blobserv client: client, } if !skipStartupCheck { - // TODO: do a server stat or something to check password + // Do a quick dummy operation to check that our credentials are + // correct. + // TODO(bradfitz,mpl): skip this operation smartly if it turns out this is annoying/slow for whatever reason. + c := make(chan blobref.SizedBlobRef, 1) + err = sto.EnumerateBlobs(c, "", 1, 0) + if err != nil { + return nil, err + } } return sto, nil } @@ -94,9 +101,9 @@ func (sto *remoteStorage) MaxEnumerate() int { return 1000 } func (sto *remoteStorage) EnumerateBlobs(dest chan<- blobref.SizedBlobRef, after string, limit int, wait time.Duration) error { return sto.client.EnumerateBlobsOpts(dest, client.EnumerateOpts{ - After: after, - MaxWait: wait, - Limit: limit, + After: after, + MaxWait: wait, + Limit: limit, }) }