S3: Enable debug logging when annex.debug or --debug is set.
To debug a bug report, but generally useful.
This commit is contained in:
parent
a7c35d6961
commit
3b3aaf0d56
3 changed files with 32 additions and 3 deletions
11
Remote/S3.hs
11
Remote/S3.hs
|
@ -28,6 +28,7 @@ import Control.Monad.Trans.Resource
|
|||
import Control.Monad.Catch
|
||||
import Data.Conduit
|
||||
import Data.IORef
|
||||
import System.Log.Logger
|
||||
|
||||
import Common.Annex
|
||||
import Types.Remote
|
||||
|
@ -149,7 +150,7 @@ s3Setup' u mcreds c = if configIA c then archiveorg else defaulthost
|
|||
writeUUIDFile archiveconfig u
|
||||
use archiveconfig
|
||||
|
||||
-- Sets up a http connection manager for S3 encdpoint, which allows
|
||||
-- Sets up a http connection manager for S3 endpoint, which allows
|
||||
-- http connections to be reused across calls to the helper.
|
||||
prepareS3 :: Remote -> S3Info -> (S3Handle -> helper) -> Preparer helper
|
||||
prepareS3 r info = resourcePrepare $ const $
|
||||
|
@ -388,13 +389,13 @@ sendS3Handle'
|
|||
=> S3Handle
|
||||
-> r
|
||||
-> ResourceT IO a
|
||||
sendS3Handle' h = AWS.pureAws (hawscfg h) (hs3cfg h) (hmanager h)
|
||||
sendS3Handle' h r = AWS.pureAws (hawscfg h) (hs3cfg h) (hmanager h) r
|
||||
|
||||
withS3Handle :: RemoteConfig -> UUID -> S3Info -> (S3Handle -> Annex a) -> Annex a
|
||||
withS3Handle c u info a = do
|
||||
creds <- getRemoteCredPairFor "S3" c (AWS.creds u)
|
||||
awscreds <- liftIO $ genCredentials $ fromMaybe nocreds creds
|
||||
let awscfg = AWS.Configuration AWS.Timestamp awscreds (AWS.defaultLog AWS.Error)
|
||||
let awscfg = AWS.Configuration AWS.Timestamp awscreds debugMapper
|
||||
bracketIO (newManager httpcfg) closeManager $ \mgr ->
|
||||
a $ S3Handle mgr awscfg s3cfg info
|
||||
where
|
||||
|
@ -518,3 +519,7 @@ genCredentials (keyid, secret) = AWS.Credentials
|
|||
mkLocationConstraint :: AWS.Region -> S3.LocationConstraint
|
||||
mkLocationConstraint "US" = S3.locationUsClassic
|
||||
mkLocationConstraint r = r
|
||||
|
||||
debugMapper :: AWS.Logger
|
||||
debugMapper AWS.Debug t = debugM "S3" (T.unpack t)
|
||||
debugMapper _ _ = noop
|
||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
|||
git-annex (5.20150421) UNRELEASED; urgency=medium
|
||||
|
||||
* S3: Enable debug logging when annex.debug or --debug is set.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
|
||||
|
||||
git-annex (5.20150420) unstable; urgency=medium
|
||||
|
||||
* Fix activity log parsing, which caused the log to not retain
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2015-04-21T19:23:18Z"
|
||||
content="""
|
||||
So the http 301 redirect seems to be the relevant clue.
|
||||
|
||||
Perhaps the old S3 library followed such redirects and the new aws library
|
||||
does not. Although AFAICS, http-client should follow redirects by default.
|
||||
|
||||
Are you able to store new files in this remote and get them back out?
|
||||
|
||||
Which Amazon datacenter is the bucket at?
|
||||
|
||||
I've added some more debugging to the S3 remote; --debug will now
|
||||
have it log the http requests and responses. Perhaps this will give us
|
||||
more clues to the problem.
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue