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

Fix update indexes running when not necessary #1063

Merged
merged 2 commits into from Nov 16, 2020

Conversation

silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented Nov 11, 2020

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce?

An overall enhancement of the CLI behaviour.

  • What is the current behavior?

If a local index file is missing the CLI tries to download it from the related additional URL whenever it tries to create a new internal instance, if that URL is unreachable for any reason the subsequent command always fails.
This would happen when executing any command.

  • What is the new behavior?

Indexes update is now only executed for certain specific commands like update, core update-index, lib update-index and core search, or whenever the library_index.json or package_index.json files are missing.

The initialization of an internal CLI instance still makes the whole command fail if a local index file is missing but the message is clearer now.

Updating indexes now shows a clear error if an URL is unreachable for any reason, we check for 4xx or 5xx HTTP status codes so in those cases it fails.

  • Does this PR introduce a breaking change?

No.

  • Other information:

None.

This should also fix #1050.


See how to contribute

@silvanocerza silvanocerza self-assigned this Nov 11, 2020
@silvanocerza silvanocerza changed the title Scerza/fix compile update index Fix update indexes running when not necessary Nov 11, 2020
@silvanocerza silvanocerza force-pushed the scerza/fix-compile-update-index branch 2 times, most recently from e92a83b to 2828f1a Compare November 12, 2020 11:19
@silvanocerza
Copy link
Contributor Author

Updated the PR with a different behaviour, now we make the CLI fail if local indexes related to a certain URL are not found, in these cases the user should try to update the indexes.
We also enhanced the error messages when updating indexes with update and core update-index if any URL is not reachable.

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

Successfully merging this pull request may close these issues.

Invalid json when updating index
1 participant