★ wanayoo — archive 1999 https://github.com/PowerShell/PowerShellGet/issues/287Nouvelle recherche | Portail wanayoo
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

Find-PSResource searches through all registered repositories if resource is published to a local one #287

Closed
anamnavi opened this issue Oct 20, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@anamnavi
Copy link
Collaborator

@anamnavi anamnavi commented Oct 20, 2020 •

Summary: If a resource is registered to a local repository (one with a URL starting with "file://") and you do Find-PSResource it searches through all registered repositories, even if it finds the resource in the local repository early on. Additionally as a result if the resource is registered to multiple local repositories this will cause the cmdlet to return multiple repositories. This is inconsistent with how the cmdlet acts for remote registered cmdlets and takes significantly more time (performance concern).

To replicate:
mkdir my_test_module`` New-ModuleManifest -Path ./test_local_module/test_local_module.psd1 -Description "a test"
Register-PSResourceRepository -Name "psgettestlocal3" -URL "C:/Repos/testdir3" -Priority 30
Register-PSResourceRepository -Name "psgettestlocal4" -URL "C:/Repos/testdir4" -Priority 25
Publish-PSResource -Path .\test_local_module\ -Repository psgettestlocal3
Publish-PSResource -Path .\test_local_module\ -Repository psgettestlocal4
Find-PSResource "test_local_module"

returns multiple resources as so:
multipleResources

I ran Find-PSResource "test_local_module" with -Verbose and -Debug switches and it shows that for local repos it starts searching repos in order of which has highest ranking priority first, searches in psgettestlocal3 and psgettestlocal4 (without printing a module could not be found in repository message but keeps searching through all other repositories registered.

@anamnavi anamnavi added the Area-Find label Oct 20, 2020
@anamnavi anamnavi self-assigned this Oct 20, 2020
@issue-label-bot issue-label-bot bot added the bug label Oct 20, 2020
@issue-label-bot
Copy link

@issue-label-bot issue-label-bot bot commented Oct 20, 2020

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.69. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Preview 3 Release
Awaiting triage
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.