Don't assume string params to Install are identifiers #2764
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
CmdLine's
ckan install identifier=version
syntax is broken:(The list of modules to install is missing.)
This also affects the
ckan install -c localfile.ckan
syntax:Which also breaks pull request validation:
https://ci.ksp-ckan.space/job/NetKAN/8294/console
(Nothing gets installed.)
Noticed while checking validation of KSP-CKAN/NetKAN#7194.
Cause
This line from #2753 assumed that the list of strings passed to
InstallList
are pure identifiers:CKAN/Core/ModuleInstaller.cs
Line 140 in 8eabff4
But they can include the version as well, so comparing them to identifiers doesn't work as intended.
Changes
Now instead of checking that the module's identifier is present in the parameter list, we check that the resolver's
ReasonFor
isUserRequested
. This has the intended effect of passing only CkanModules that were specified in the parameters (so the rest can be flagged as auto-installed), but does not break theidentifier=version
syntax.And since it's kind of shocking that functionality this important broke and no one noticed, a new ModuleInstaller test is added for the
identifier=version
syntax, which fails on master and passes on this branch.