Page MenuHomeSoftware Heritage

deposit.cli: Generate uuid as is
ClosedPublic

Authored by ardumont on Apr 15 2019, 3:43 PM.

Details

Summary

Expose optional external id in deposit status endpoint

As this is generated, this could be useful for client who wants to
deposit further new version

From docker-env (manually formatted):

INFO:swh.deposit.cli.deposit:{
'deposit_id': '3',
'deposit_status': 'done',
'deposit_status_detail': 'The deposit has been successfully loaded into the Software Heritage archive',
'deposit_swh_id': 'swh:1:dir:3b0919ddd42be1ba0405d33f383b6e0ee8dedcba',
'deposit_swh_id_context': 'swh:1:dir:3b0919ddd42be1ba0405d33f383b6e0ee8dedcba;origin=https://forge.softwareheritage.org/source/jesuisgpl/',
'deposit_swh_anchor_id': 'swh:1:rev:7336885eda39fb1f7265c0e8ea75b139cc1773d4',
'deposit_swh_anchor_id_context': 'swh:1:rev:7336885eda39fb1f7265c0e8ea75b139cc1773d4;origin=https://forge.softwareheritage.org/source/jesuisgpl/',
'deposit_external_id': '6a7ef0a1-e88d-4590-b153-2ae9dce3c7ee'  # <- HERE we go!
}
Test Plan

tox

Diff Detail

Repository
rDDEP swh-deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont created this revision.Apr 15 2019, 3:43 PM
douardda added inline comments.Apr 15 2019, 5:02 PM
swh/deposit/api/deposit_status.py
43–63 ↗(On Diff #4581)

Shouldn't this be the time to think about something like:

context = {
    'deposit_id': deposit.id,
    'status_detail': status_detail, 
}
keys = ('status', 'swh_id', 'swh_id_context', 'swh_anchor_id', 'swh_anchor_id_context', 'external_id')
for k in keys:
    context[k] = getattr(deposit, k, None)

?

ardumont added inline comments.Apr 15 2019, 6:46 PM
swh/deposit/api/deposit_status.py
43–63 ↗(On Diff #4581)

sure

ardumont updated this revision to Diff 4585.Apr 15 2019, 6:50 PM
  • deposit_status: Simplify the deposit status computation
This revision is now accepted and ready to land.Apr 16 2019, 11:30 AM
ardumont updated this revision to Diff 4592.Apr 16 2019, 1:45 PM

Plug diff on master

This revision was automatically updated to reflect the committed changes.