S3: Support versioning=yes with a readonly bucket.
Needs aws-0.24.3.
This commit is contained in:
parent
03662e4d83
commit
a16bf4f914
3 changed files with 19 additions and 3 deletions
|
@ -3,6 +3,8 @@ git-annex (10.20241032) UNRELEASED; urgency=medium
|
||||||
* git-remote-annex: Fix a reversion introduced in version 10.20241031
|
* git-remote-annex: Fix a reversion introduced in version 10.20241031
|
||||||
that broke cloning from a special remote.
|
that broke cloning from a special remote.
|
||||||
* vpop: Only update state after successful checkout.
|
* vpop: Only update state after successful checkout.
|
||||||
|
* S3: Support versioning=yes with a readonly bucket.
|
||||||
|
(Needs aws-0.24.3)
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 11 Nov 2024 12:26:00 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 11 Nov 2024 12:26:00 -0400
|
||||||
|
|
||||||
|
|
19
Remote/S3.hs
19
Remote/S3.hs
|
@ -1341,11 +1341,24 @@ enableBucketVersioning ss info _ _ _ = do
|
||||||
where
|
where
|
||||||
enableversioning b = do
|
enableversioning b = do
|
||||||
#if MIN_VERSION_aws(0,21,1)
|
#if MIN_VERSION_aws(0,21,1)
|
||||||
showAction "enabling bucket versioning"
|
showAction "checking bucket versioning"
|
||||||
hdl <- mkS3HandleVar c gc u
|
hdl <- mkS3HandleVar c gc u
|
||||||
|
let setversioning = S3.putBucketVersioning b S3.VersioningEnabled
|
||||||
withS3HandleOrFail u hdl $ \h ->
|
withS3HandleOrFail u hdl $ \h ->
|
||||||
void $ liftIO $ runResourceT $ sendS3Handle h $
|
#if MIN_VERSION_aws(0,24,3)
|
||||||
S3.putBucketVersioning b S3.VersioningEnabled
|
liftIO $ runResourceT $
|
||||||
|
tryS3 (sendS3Handle h setversioning) >>= \case
|
||||||
|
Right _ -> return ()
|
||||||
|
Left err -> do
|
||||||
|
res <- sendS3Handle h $
|
||||||
|
S3.getBucketVersioning b
|
||||||
|
case S3.gbvVersioning res of
|
||||||
|
Just S3.VersioningEnabled -> return ()
|
||||||
|
_ -> giveup $ "This bucket does not have versioning enabled, and enabling it failed: "
|
||||||
|
++ T.unpack (S3.s3ErrorMessage err)
|
||||||
|
#else
|
||||||
|
void $ liftIO $ runResourceT $ sendS3Handle h go
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
showLongNote $ unlines
|
showLongNote $ unlines
|
||||||
[ "This version of git-annex cannot auto-enable S3 bucket versioning."
|
[ "This version of git-annex cannot auto-enable S3 bucket versioning."
|
||||||
|
|
|
@ -16,3 +16,4 @@ packages:
|
||||||
resolver: nightly-2024-07-29
|
resolver: nightly-2024-07-29
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- filepath-bytestring-1.4.100.3.2
|
- filepath-bytestring-1.4.100.3.2
|
||||||
|
- aws-0.24.3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue