Skip to content
Snippets Groups Projects
Commit 72655208 authored by vlorentz's avatar vlorentz
Browse files

Update for swh-objstorage >= 2.0.0

* objstorage.add() now requires an id as second argument
* objstorage.get() now allows a dict of hashes instead of just
  sha1, and a future version will require this dict
parent c8e77380
No related branches found
No related tags found
No related merge requests found
......@@ -375,11 +375,10 @@ class ORCExporter(ExporterDispatch):
content_writer = self.get_writer_for("content")
data = None
if self.with_data:
obj_id = content[ID_HASH_ALGO]
try:
data = self.objstorage.get(obj_id)
data = self.objstorage.get(content)
except ObjNotFoundError:
logger.warning(f"Missing object {hash_to_hex(obj_id)}")
logger.warning("Missing object %s", hash_to_hex(content[ID_HASH_ALGO]))
content_writer.write(
(
......
......@@ -327,7 +327,7 @@ def test_export_content_with_data(monkeypatch, tmpdir):
obj_type = "content"
objstorage = get_objstorage("memory")
for content in TEST_OBJECTS[obj_type]:
objstorage.add(content=content.data, obj_id=content.sha1)
objstorage.add(content=content.data, obj_id=content.hashes())
def get_objstorage_mock(**kw):
if kw.get("cls") == "mock":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment