PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Repository store (PSRepositories.xml) should have 'reset' functionality

Open alerickson opened this issue 3 years ago • 2 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

If the repository store gets corrupted, PSGet throws an error from attempting to parse the file. At the very least, error messaging should provide user with steps to remedy the situation. We should, however, also add either a new parameter or a new cmdlet that allows users to delete the old PSRepositories.xml file and create a new default file.

I'm proposing: Register-PSResourceRepository -Reset which, again, would delete the current PSRepositories.xml file, create a new one, and then register only the PowerShellGallery.

Expected behavior

If the xml file is unable to be parsed, an error throws telling the user that there was a parse error and suggesting to either try rerunning the command or running Register-PSResourceRepository -Reset to reset the repository store.

Actual behavior

Throws parse error and fails.

Error details

No response

Environment data

All versions and OS.

Visuals

No response

alerickson avatar Feb 15 '22 19:02 alerickson

Adding some ShouldProcess logic in order to make sure the user understands what is happening and where the file is that they are going to reset

StevenBucher98 avatar Feb 24 '22 16:02 StevenBucher98

Instead of trying to do too much with Register-PSResourceRepository and adding more parameters there. A better idea would be to create a new cmdlet that does that Reset-PSResourceRepository.

ThomasNieto avatar May 10 '22 19:05 ThomasNieto