Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: update of funders fail due to missing datastream config variables #356

Open
zzacharo opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@zzacharo
Copy link
Member

Use case

The use case we have is to update the list of funders.

Current behaviour

In an instance e.g cds-rdm we hold a funder.yaml file with the following syntax:

- id: 00k4n6c32
  country: BE
  identifiers:
    - identifier: 00k4n6c32
      scheme: ror
  name: European Commission
  title:
    en: European Commission

If we add a new funder in the list and then we run the command invenio vocabularies update -v funders -f app_data/vocabularies.yaml then we get an error:

Traceback (most recent call last):
  File "/usr/local/bin/invenio", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 357, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/invenio_vocabularies/cli.py", line 103, in update
    for w_conf in config["writers"]:
KeyError: 'writers'

The update works if you update the app_data/vocabularies.yaml as below:

funders:
  pid-type: fun
  data-file: updated_funders.yaml
  readers:
    - type: yaml
  writers:
    - type: funders-service
      args:
        update: True

Expected solution

We should either fix the cli command to incorporate a more user friendly way of updating a vocabulary entry e.g identify if the data-file is a yaml and use the correct reader or indicate another way of updating or inserting entries in a vocabulary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant