mirror of https://github.com/perkeep/perkeep.git
camput: actually catch errors when trying to upload,
also added startupcheck for remote blobserver Change-Id: Id9f5383c6fd3fdf697f2b75052f3e63b0972205d
This commit is contained in:
parent
71ab8c787b
commit
326d62aea4
|
@ -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()
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue