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

Install should not silently fail #554

Merged
merged 17 commits into from Dec 7, 2021

Conversation

anamnavi
Copy link
Member

@anamnavi anamnavi commented Dec 1, 2021

PR Summary

Install-PSResource should not fail silently. Most of these cases were resolved by PR #525. However for the cases where a package name requested to be installed doesn't exist we want it to not fail silently.

The new logic is that in InstallHelper we begin with a list of package names (passed in) for packages we wish to install. As installation attempts happen if the installation is successful we remove the name of the installed package from the original list of package names. If the attempt is unsuccessful we write an error and then also remove the name of that package from the original list of package names. At the end, the original list of names is either empty or left with names of packages we couldn't install because they couldn't be found (either name or version for that package). We then write errors for those packages not being found.

InstallHelper handles writing the errors because this way Install-PSResource, Update-PSResource, and Save-PSResource can all leverage the error handling.

PR Context

Resolves #154

PR Checklist

src/code/InstallPSResource.cs Outdated Show resolved Hide resolved
@anamnavi anamnavi requested review from PaulHigin and alerickson Dec 1, 2021
src/code/InstallPSResource.cs Outdated Show resolved Hide resolved
src/code/InstallPSResource.cs Outdated Show resolved Hide resolved
src/code/InstallPSResource.cs Outdated Show resolved Hide resolved
src/code/InstallPSResource.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@PaulHigin PaulHigin left a comment

LGTM

@anamnavi anamnavi merged commit d4e0262 into PowerShell:master Dec 7, 2021
10 checks passed
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.

3 participants