Staging instance, all changes can be removed at any time

Skip to content

deposit.cli: Fix service document error when failing to retrieve it

Prior to this, failing to retrieve the collection (wrong credential for example) would end up with yet another unrelated parsing error.

  • [1]
swh deposit metadata-only --url http://localhost:5080/deposit \
  --username test \
  --password test2 \
  --metadata ../deposit-swh.update-metadata.xml --format json
Traceback (most recent call last):
  File "/home/tony/.virtualenvs/swh/bin/swh", line 33, in <module>
    sys.exit(load_entry_point('swh.core', 'console_scripts', 'swh')())
  File "/home/tony/work/inria/repo/swh/swh-environment/swh-core/swh/core/cli/__init__.py", line 185, in main
    return swh(auto_envvar_prefix="SWH")
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/tony/work/inria/repo/swh/swh-environment/swh-deposit/swh/deposit/cli/client.py", line 570, in metadata_only
    collection = _collection(client)
  File "/home/tony/work/inria/repo/swh/swh-environment/swh-deposit/swh/deposit/cli/client.py", line 145, in _collection
    msg = sd_content["error"]["sword:summary"]
KeyError: 'sword:summary'

Test Plan

one test added


Migrated from D5300 (view on Phabricator)

Merge request reports

Loading