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

Replace repo-reinst with kraken, handle in UIs #3344

Merged
merged 3 commits into from
Apr 27, 2021

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Apr 11, 2021

Background

When you refresh the registry, if the metadata for one of your installed modules has been changed upstream, CKAN will ask whether you want to reinstall those modules, and if you say Yes, it will reinstall them.

The following mods have had their metadata changed since last update:

- Buffalo v2.9.0
- WildBlueTools v1.81.5
- ExtraPlanetaryLaunchpads 6.8.3.0
- ClassicStockResources v1.1.4

You should reinstall them in order to preserve consistency with the repository.

Do you wish to reinstall now?

Problems

If one of your installed modules has been updated to have a new dependency on a virtual module, the reinstall fails:

Failed to connect to repository. Exception: Too many mods provide Buffalo-PlayMode:
* Buffalo-PlayMode-CRP v2.10.2
* Buffalo-PlayMode-ClassicStock v2.10.2
* WildBlue-PlayMode-Pristine v1.82.1
* WildBlue-PlayMode-Simplified v1.82.1
* WildBlue-PlayMode-USI v1.0.0.2

Causes

Repo.HandleModuleChanges creates its own ModuleInstaller to try to do the reinstall.

When a dependency on a virtual module is found, ModuleInstaller (via other classes) throws TooManyModsProvideKraken. The UI is supposed to catch this, prompt the user, add the module they chose to the change set, and try again. However, this is impossible in the case of a repo-reinstall, because the UI does not know what changes Repo.HandleModuleChanges was attempting to make and cannot retry the repo update to fix it.

Changes

Now instead of initiating a half-hearted attempt at doing a reinstall itself, Repo.HandleModuleChanges throws a new ReinstallModulesKraken to instruct the UI-specific calling code to reinstall the given modules. Cmdline, ConsoleUI, and GUI are updated to catch this exception and launch into their upgrade flows for the given modules.

Now ConsoleUI and GUI perform upgrades after installs, so the installs (which contain the user's choice of virtual module providers) can satisfy dependencies needed by the upgrades.

As a side fix, Cmdline's ckan upgrade command is updated to handle prompting for virtual module providers (in a shared function also now called by the repo update code as needed).

Fixes #1889.
Fixes #3335.

@HebaruSan HebaruSan added Bug Something is not working as intended GUI Issues affecting the interactive GUI Cmdline Issues affecting the command line Core (ckan.dll) Issues affecting the core part of CKAN Pull request Relationships Issues affecting depends, recommends, etc. ConsoleUI Issues affecting the interactive console UI labels Apr 11, 2021
@HebaruSan HebaruSan requested a review from DasSkelett April 11, 2021 18:55
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, works perfectly!

@HebaruSan HebaruSan merged commit 8f2a1d8 into KSP-CKAN:master Apr 27, 2021
@HebaruSan HebaruSan deleted the fix/repo-reinst branch January 26, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Cmdline Issues affecting the command line ConsoleUI Issues affecting the interactive console UI Core (ckan.dll) Issues affecting the core part of CKAN GUI Issues affecting the interactive GUI Relationships Issues affecting depends, recommends, etc.
Projects
None yet
2 participants