Page MenuHomeSoftware Heritage

server: Fix metadata-only deposit which are currently rejected
ClosedPublic

Authored by ardumont on Dec 15 2020, 1:47 PM.

Details

Summary

Otherwise, a check task is scheduled for checks and current metadata-only
deposit are rejected with a "Deposit without archive is rejected" message.

Which in this case is not correct.

Related to T2886

Test Plan

tox

Diff Detail

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

Event Timeline

vlorentz added a subscriber: vlorentz.

And let's not forget to write tests later

swh/deposit/api/common.py
820–822

I don't think it needs to be called at all.

This revision now requires changes to proceed.Dec 15 2020, 1:48 PM
swh/deposit/api/common.py
820–822

it fails without it (tested on staging, i got a stacktrace)

Build is green

Patch application report for D4742 (id=16794)

Rebasing onto d1b17353e1...

Current branch diff-target is up to date.
Changes applied before test
commit 49d5c0918a3232c73bc0ae3581af40b46e85a474
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Dec 15 13:39:29 2020 +0100

    server: Fix metadata-only deposit which are currently rejected
    
    Otherwise, a check task is scheduled for checks and current metadata-only
    deposit are rejected with a "Deposit without archive is rejected" message.
    
    Which in this case is not correct.
    
    Related to T2886

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/487/ for more details.

swh/deposit/api/common.py
820–822

error without [1]
(my first approach was naively to push the _deposit_put call down, after the conditional and kaboom [1])

[1] P907

swh/deposit/api/common.py
820–822

Ah yes, you just need to call deposit.save() so Django gets a PK it can use as the FK in the deposit request table.

Create the deposit reference prior to trigger the metadata-only deposit

This revision is now accepted and ready to land.Dec 15 2020, 2:20 PM

Build is green

Patch application report for D4742 (id=16796)

Rebasing onto d1b17353e1...

Current branch diff-target is up to date.
Changes applied before test
commit ef2bc2ecec39e979e6cb6a9cf66db5d792670c89
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Dec 15 13:39:29 2020 +0100

    server: Fix metadata-only deposit which are currently rejected
    
    Otherwise, a check task is scheduled for checks and current metadata-only
    deposit are rejected with a "Deposit without archive is rejected" message.
    
    Which in this case is not correct.
    
    Related to T2886

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/488/ for more details.