summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-21 15:55:42 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-21 15:55:42 -0400
commit4da106cf1703c763f6cbe3d2843e5e10f4160405 (patch)
tree2e72a387407f11dc37c7b9b233f119d27c0cada7
parent6f2626801bb0b70ea2c652ffad03138178cefe4e (diff)
S3: Enable debug logging when annex.debug or --debug is set.
To debug a bug report, but generally useful.
-rw-r--r--Remote/S3.hs11
-rw-r--r--debian/changelog6
-rw-r--r--doc/bugs/Can__39__t_get_content_from_S3_with_s3-aws_library/comment_1_533c4a26200501486a9ec103e1301391._comment18
3 files changed, 32 insertions, 3 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index b0c1de114..06aa79d65 100644
--- a/Remote/S3.hs
+++ b/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
diff --git a/debian/changelog b/debian/changelog
index eda96be46..ad08554d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/bugs/Can__39__t_get_content_from_S3_with_s3-aws_library/comment_1_533c4a26200501486a9ec103e1301391._comment b/doc/bugs/Can__39__t_get_content_from_S3_with_s3-aws_library/comment_1_533c4a26200501486a9ec103e1301391._comment
new file mode 100644
index 000000000..8921214a9
--- /dev/null
+++ b/doc/bugs/Can__39__t_get_content_from_S3_with_s3-aws_library/comment_1_533c4a26200501486a9ec103e1301391._comment
@@ -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.
+"""]]