Skip to content

deposit_client: Allow deposit metadata update on completed deposit

This opens the --swhid to the swh upload cli.

If the update is ok, this returns the unchanged status summary of the deposit. Otherwise, for example, update a non-complete deposit (status not "done"), this returns an explicit error.

Scenario around those cases are explicited in the diff.

Sample cli:

swh deposit upload \
  --url https://deposit.internal.staging.swh.network/ \
  --username swh \
  --password $(swhpass ls operations/deposit.softwareheritage.org/http-auth/swh | head -1) \
  --metadata "./deposit-update.xml" \ # [1]
  --deposit-id 605 \
  --swhid swh:1:dir:ef04a768181417fbc5eef4243e2507915f24deea
  • [1] deposit-update.xml
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0">
	<name>test-project</name>
	<author>ardumont</author>
	<codemeta:identifier>38857a56-bab9-46f6-9087-6f91f3e1be89</codemeta:identifier>
</entry>

This cli sample is the equivalent of swh/meta$812 (which uses curl).

Related to #2538 (closed)

Test Plan

tox

Using this code and the staging deposit server, it is happy with the following:

Oct 12 11:03:21 deposit python3[181685]: 2020-10-12 11:03:21 [181685] gunicorn.access:INFO 127.0.0.1 - swh [12/Oct/2020:11:03:21 +0000] "PUT /1/swh/605/metadata/ HTTP/1.1" 204 0 "-" "python-requests/2.20.1"

Migrated from D4228 (view on Phabricator)

Merge request reports

Loading