S3: git annex info will show additional information about a S3 remote (endpoint, port, storage class)

This commit is contained in:
Joey Hess 2015-04-23 14:12:25 -04:00
parent d469875f4b
commit b3eccec68c
2 changed files with 18 additions and 7 deletions

View file

@ -28,6 +28,7 @@ import Control.Monad.Trans.Resource
import Control.Monad.Catch import Control.Monad.Catch
import Data.Conduit import Data.Conduit
import Data.IORef import Data.IORef
import Data.Bits.Utils
import System.Log.Logger import System.Log.Logger
import Common.Annex import Common.Annex
@ -89,13 +90,7 @@ gen r u c gc = do
, availability = GloballyAvailable , availability = GloballyAvailable
, remotetype = remote , remotetype = remote
, mkUnavailable = gen r u (M.insert "host" "!dne!" c) gc , mkUnavailable = gen r u (M.insert "host" "!dne!" c) gc
, getInfo = includeCredsInfo c (AWS.creds u) $ catMaybes , getInfo = includeCredsInfo c (AWS.creds u) (s3Info c)
[ Just ("bucket", fromMaybe "unknown" (getBucketName c))
, if configIA c
then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucketName c)
else Nothing
, Just ("partsize", maybe "unlimited" (roughSize storageUnits False) (getPartSize c))
]
, claimUrl = Nothing , claimUrl = Nothing
, checkUrl = Nothing , checkUrl = Nothing
} }
@ -528,3 +523,17 @@ debugMapper level t = forward "S3" (T.unpack t)
AWS.Info -> infoM AWS.Info -> infoM
AWS.Warning -> warningM AWS.Warning -> warningM
AWS.Error -> errorM AWS.Error -> errorM
s3Info :: RemoteConfig -> [(String, String)]
s3Info c = catMaybes
[ Just ("bucket", fromMaybe "unknown" (getBucketName c))
, Just ("endpoint", w82s (S.unpack (S3.s3Endpoint s3c)))
, Just ("port", show (S3.s3Port s3c))
, Just ("storage class", show (getStorageClass c))
, if configIA c
then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucketName c)
else Nothing
, Just ("partsize", maybe "unlimited" (roughSize storageUnits False) (getPartSize c))
]
where
s3c = s3Configuration c

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
* S3: Enable debug logging when annex.debug or --debug is set. * S3: Enable debug logging when annex.debug or --debug is set.
* Dropped support for older versions of yesod, warp, and dbus than the ones * Dropped support for older versions of yesod, warp, and dbus than the ones
in Debian Jessie. in Debian Jessie.
* S3: git annex info will show additional information about a S3 remote
(endpoint, port, storage class)
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400 -- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400