support S3 front-end used by globalways.net

This threw an unusual exception w/o an error message when probing to see if
the bucket exists yet. So rather than relying on tryS3, catch all
exceptions.

This does mean that it might get an exception for some transient network
error, think this means the bucket DNE yet, and try to create it, and then
fail when it already exists.
This commit is contained in:
Joey Hess 2014-11-05 12:42:12 -04:00
parent 4eca1a05de
commit 0a891fcfc5

View file

@ -299,7 +299,7 @@ genBucket c u = do
where
go _ (Right True) = noop
go h _ = do
v <- tryS3 $ sendS3Handle h (S3.getBucket $ bucket $ hinfo h)
v <- tryNonAsync $ sendS3Handle h (S3.getBucket $ bucket $ hinfo h)
case v of
Right _ -> noop
Left _ -> do
@ -323,9 +323,8 @@ writeUUIDFile :: RemoteConfig -> UUID -> S3Handle -> Annex ()
writeUUIDFile c u h = do
v <- checkUUIDFile c u h
case v of
Left e -> throwM e
Right True -> noop
Right False -> void $ sendS3Handle h mkobject
_ -> void $ sendS3Handle h mkobject
where
file = T.pack $ uuidFile c
uuidb = L.fromChunks [T.encodeUtf8 $ T.pack $ fromUUID u]