From fa1318479e6f10fb51da66dcdcb551bb95af9e1a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 Oct 2014 15:56:35 -0400 Subject: [PATCH] rename isIA to configIA Already done on s3-aws branch, so reduce divergence. --- Assistant/WebApp/Configurators/AWS.hs | 4 ++-- Assistant/WebApp/Configurators/Edit.hs | 2 +- Assistant/WebApp/Configurators/IA.hs | 2 +- Remote/S3.hs | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Assistant/WebApp/Configurators/AWS.hs b/Assistant/WebApp/Configurators/AWS.hs index fa0c23bea1..7c91d70b0f 100644 --- a/Assistant/WebApp/Configurators/AWS.hs +++ b/Assistant/WebApp/Configurators/AWS.hs @@ -162,7 +162,7 @@ getEnableS3R :: UUID -> Handler Html #ifdef WITH_S3 getEnableS3R uuid = do m <- liftAnnex readRemoteLog - if maybe False S3.isIA (M.lookup uuid m) + if maybe False S3.confgiIA (M.lookup uuid m) then redirect $ EnableIAR uuid else postEnableS3R uuid #else @@ -224,5 +224,5 @@ previouslyUsedAWSCreds :: Annex (Maybe CredPair) previouslyUsedAWSCreds = getM gettype [S3.remote, Glacier.remote] where gettype t = previouslyUsedCredPair AWS.creds t $ - not . S3.isIA . Remote.config + not . S3.configIA . Remote.config #endif diff --git a/Assistant/WebApp/Configurators/Edit.hs b/Assistant/WebApp/Configurators/Edit.hs index 2f21925fcb..5b5b1c6d1e 100644 --- a/Assistant/WebApp/Configurators/Edit.hs +++ b/Assistant/WebApp/Configurators/Edit.hs @@ -239,7 +239,7 @@ getRepoInfo :: Maybe Remote.Remote -> Maybe Remote.RemoteConfig -> Widget getRepoInfo (Just r) (Just c) = case M.lookup "type" c of Just "S3" #ifdef WITH_S3 - | S3.isIA c -> IA.getRepoInfo c + | S3.configIA c -> IA.getRepoInfo c #endif | otherwise -> AWS.getRepoInfo c Just t diff --git a/Assistant/WebApp/Configurators/IA.hs b/Assistant/WebApp/Configurators/IA.hs index ad18003cc1..09728e6d64 100644 --- a/Assistant/WebApp/Configurators/IA.hs +++ b/Assistant/WebApp/Configurators/IA.hs @@ -107,7 +107,7 @@ iaCredsAForm defcreds = AWS.AWSCreds #ifdef WITH_S3 previouslyUsedIACreds :: Annex (Maybe CredPair) previouslyUsedIACreds = previouslyUsedCredPair AWS.creds S3.remote $ - S3.isIA . Remote.config + S3.configIA . Remote.config #endif accessKeyIDFieldWithHelp :: Maybe Text -> MkAForm Text diff --git a/Remote/S3.hs b/Remote/S3.hs index 4b60b2bfcd..281aaf6f3a 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module Remote.S3 (remote, iaHost, isIA, iaItemUrl) where +module Remote.S3 (remote, iaHost, configIA, iaItemUrl) where import Network.AWS.AWSConnection import Network.AWS.S3Object hiding (getStorageClass) @@ -74,7 +74,7 @@ gen r u c gc = new <$> remoteCost gc expensiveRemoteCost mkUnavailable = gen r u (M.insert "host" "!dne!" c) gc, getInfo = includeCredsInfo c (AWS.creds u) $ catMaybes [ Just ("bucket", fromMaybe "unknown" (getBucket c)) - , if isIA c + , if configIA c then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucket c) else Nothing ] @@ -85,7 +85,7 @@ s3Setup mu mcreds c = do u <- maybe (liftIO genUUID) return mu s3Setup' u mcreds c s3Setup' :: UUID -> Maybe CredPair -> RemoteConfig -> Annex (RemoteConfig, UUID) -s3Setup' u mcreds c = if isIA c then archiveorg else defaulthost +s3Setup' u mcreds c = if configIA c then archiveorg else defaulthost where remotename = fromJust (M.lookup "name" c) defbucket = remotename ++ "-" ++ fromUUID u @@ -136,7 +136,7 @@ prepareStore r = resourcePrepare (const $ s3Action r False) $ \(conn, bucket) -> ok <- s3Bool =<< liftIO (store (conn, bucket) r k p src) -- Store public URL to item in Internet Archive. - when (ok && isIA (config r) && not (isChunkKey k)) $ + when (ok && configIA (config r) && not (isChunkKey k)) $ setUrlPresent k (iaKeyUrl r k) return ok @@ -168,7 +168,7 @@ retrieveCheap _ _ = return False - derived from it that it does not remove. -} remove :: Remote -> RemoteConfig -> Remover remove r c k - | isIA c = do + | configIA c = do warning "Cannot remove content from the Internet Archive" return False | otherwise = remove' r k @@ -336,8 +336,8 @@ getXheaders = filter isxheader . M.assocs iaHost :: HostName iaHost = "s3.us.archive.org" -isIA :: RemoteConfig -> Bool -isIA c = maybe False isIAHost (M.lookup "host" c) +configIA :: RemoteConfig -> Bool +configIA c = maybe False isIAHost (M.lookup "host" c) isIAHost :: HostName -> Bool isIAHost h = ".archive.org" `isSuffixOf` map toLower h