datalad / datalad-catalog

Create a user-friendly data catalog from structured metadata
https://datalad-catalog.netlify.app
MIT License
14 stars 12 forks source link

catalog_set yields both "ok" and "impossible" #331

Closed mslw closed 11 months ago

mslw commented 11 months ago

When a catalog has its homepage already set, directly calling catalog_set(reckless="overwrite") updates the setting, but yields both "ok" and "impossible" results.

catalog_set(ok): catalog [Home page successfully set to: dataset_id=1234, dataset_version=latest.]
catalog_set(impossible): catalog [Home page already set: dataset_id=1234, dataset_version=2137.To overwrite this property, use '--reckless overwrite']
action summary:
  catalog_set (impossible: 1, ok: 1)
(...)
datalad.support.exceptions.IncompleteResultsError: Command did not complete successfully. 1 failed:
(...)

This is because when catalog_set() is called, yield does not terminate execution, and the code seems to be taking a shortcut / missing an else statement.

(although, when used inside another function, yield from catalog_set() would indeed stop at first yield.

jsheunis commented 11 months ago

Thanks for catching this @mslw ! I will fix it up and work it into the release.