Merge ~aciba/simplestreams:migrate-to-python3-boto3 into simplestreams:master
Proposed by
Alberto Contreras
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Paride Legovini | ||||
Approved revision: | a3e76ce0786fc2087f60a0f2541f75c472cc6e0f | ||||
Merge reported by: | Server Team CI bot | ||||
Merged at revision: | not available | ||||
Proposed branch: | ~aciba/simplestreams:migrate-to-python3-boto3 | ||||
Merge into: | simplestreams:master | ||||
Diff against target: |
129 lines (+34/-33) 2 files modified
debian/control (+1/-1) simplestreams/objectstores/s3.py (+33/-32) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paride Legovini | Approve | ||
Server Team CI bot | continuous-integration | Approve | |
simplestreams-dev | Pending | ||
Review via email: mp+464027@code.launchpad.net |
Commit message
feat(s3objectst
Migrate S3ObjectStore from python3-boto to python3-boto3.
BREAKING CHANGE: Some of the methods did not capture all the underlying
boto expeceptions, and exceptions are different between boto and boto3.
Thus, any callsite handling boto exceptions may have to adjust them.
BREAKING CHANGE: S3ObjectStore.
different in boto3. `bucket` has been removed to not couple
simplestreams' API with boto{,3}'s API. S3ObjectStore.
still exposed, so callsites can refer to it however they want.
LP: #2052437
To post a comment you must log in.
I have tested this with the following python script. Make sure to have your bucket pre-created and your aws config set.
```py
import errno
import hashlib
from functools import partial
from simplestreams. objectstores. s3 import S3ObjectStore
sos = S3ObjectStore( "s3://test- bucket- 1712739788/ myprefix/ ")
content = "content" content( path, content) content( path, content)
path = "path"
sos.insert_
sos.insert_
assert sos.source( path).read( ) == b"content"
md5 = hashlib. md5(content. encode( "utf-8" )).hexdigest( )
assert sos.exists_ with_checksum( path, {}) is False with_checksum( path, {"md5": "asdf"}) is False with_checksum( path, {"md5": md5})
assert sos.exists_
assert sos.exists_
sos.remove("path")
sos.remove("path")
sos.remove("path")
assert sos.exists_ with_checksum( path, {"md5": md5}) is False
try: source( path).read( )
sos.
except IOError as ex:
assert ex.errno == errno.ENOENT
assert str(ex) == f"Unable to open {path}"
with open(path, "wb") as f: content. encode( "utf-8" )) path).read( ) == b"content"
f.write(
sos.insert(path, partial(open, mode="rb"))
assert sos.source(
sos.remove("path")
```