Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Find-PSResource searches through all registered repositories if resource is published to a local one #287
Comments
|
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Summary: If a resource is registered to a local repository (one with a URL starting with "file://") and you do
Find-PSResourceit 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 30Register-PSResourceRepository -Name "psgettestlocal4" -URL "C:/Repos/testdir4" -Priority 25Publish-PSResource -Path .\test_local_module\ -Repository psgettestlocal3Publish-PSResource -Path .\test_local_module\ -Repository psgettestlocal4Find-PSResource "test_local_module"returns multiple resources as so:

I ran
Find-PSResource "test_local_module"with-Verboseand-Debugswitches and it shows that for local repos it starts searching repos in order of which has highest ranking priority first, searches inpsgettestlocal3andpsgettestlocal4(without printing amodule could not be found in repository messagebut keeps searching through all other repositories registered.