Skip to content

Commit

Permalink
cli: improve rebuild indices command
Browse files Browse the repository at this point in the history
* Skips services that don't implement the rebuild_index method, often
  because they inherit some record service features but don't handle
  records
* closes #2741
  • Loading branch information
ntarocco authored and slint committed Jul 11, 2024
1 parent 96d7813 commit 3ea347e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions invenio_app_rdm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,14 @@ def rebuild_all_indices(order):
service = services[service_to_reindex]
if hasattr(service, "rebuild_index"):
click.echo(f"Reindexing {service_to_reindex}... ", nl=False)
service.rebuild_index(system_identity)
click.secho("Done.", fg="green")
try:
service.rebuild_index(system_identity)
except NotImplementedError:
click.secho(
f"{service_to_reindex} does not use the search cluster, skipping.",
fg="green",
)
continue
else:
# success
click.secho("Done.", fg="green")

0 comments on commit 3ea347e

Please sign in to comment.