Skip to content

cli.deposit: Add mandatory flags to generate the metadata xml

Metadata file is now generated if the user provides the authors (multiple --author flags) and the name.

Related #1650 (closed)

Test Plan

shell 1:

$ workon swh
$ doco up -d swh-deposit
$ doco logs -f swh-deposit

shell 2:

$ workon swh
$ swh-deposit deposit --verbose --username test --password test \
  --archive ../swh-docker-dev.tgz \
  --name swh-docker-dev \
  --author 'Antoine r. Dumont (@ardumont)' \
  --author 'Morane Gruenpeter'

INFO:swh.deposit.cli.deposit:{'deposit_id': '4', 'deposit_status': 'deposited', 'deposit_status_detail': None, 'deposit_date': 'April 16, 2019, 10:25 a.m.'}

We could still use the old way (mentioning the metadata file):

$ swh-deposit deposit --url http://localhost:5006/1 \
  --verbose \
  --username test \
  --password test \
  --collection test \
  --archive ../swh-docker-dev.tgz \
  --metadata ../swh-docker-dev.tgz.metadata.xml

INFO:swh.deposit.cli.deposit:{'deposit_id': '5', 'deposit_status': 'deposited', 'deposit_status_detail': None, 'deposit_date': 'April 16, 2019, 10:28 a.m.'}

You got rejected if you mention neither --metadata nor (--author and --name).

$ swh-deposit deposit --url http://localhost:5006/1 \
  --verbose \
  --username test \ 
  --password test \
  --collection test \
  --archive ../swh-docker-dev.tgz

INFO:swh.deposit.cli.deposit:{'error': 'Problem during parsing options: Either metadata deposit file or (`--name`  and `--author`) fields must be provided'}

Note: This assumes the use of the virtualenv and the swh-docker-dev as per swh's getting-started.


Migrated from D1419 (view on Phabricator)

Merge request reports