Skip to content
Snippets Groups Projects
Unverified Commit 25786360 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

swh.deposit.client: Fix corner cases on cli

parent 2e704b59
No related branches found
No related tags found
No related merge requests found
......@@ -81,12 +81,16 @@ def parse_cli_options(username, password, archive, metadata,
if status and not deposit_id:
raise InputError("Deposit id must be provided for status check")
if status and deposit_id: # status is higher priority over deposit
archive_deposit = False
metadata_deposit = False
if archive_deposit and metadata_deposit:
# too many flags use, remove redundant ones (-> multipart deposit)
archive_deposit = False
metadata_deposit = False
if archive and not os.path.exists(archive):
if archive_deposit and archive and not os.path.exists(archive):
raise InputError('Software Archive %s must exist!' % archive)
if archive and not metadata:
......@@ -101,9 +105,12 @@ def parse_cli_options(username, password, archive, metadata,
if metadata_deposit and not metadata:
raise InputError("Metadata deposit filepath must be provided for a metadata deposit") # noqa
if not status and not archive_deposit and not os.path.exists(metadata):
if not status and metadata_deposit and not os.path.exists(metadata):
raise InputError('Software Archive metadata %s must exist!' % metadata)
if not status and not archive and not metadata:
raise InputError('You should at least mention an action to do')
if replace and not deposit_id:
raise InputError(
'To update an existing deposit, you must provide its id')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment