Repository navigation
Multiple Cmdlets emits unneeded log/errors #1993
Copy link
Copy link
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
PS /tmp/jjj> $informationPreference = 'Continue'
PS /tmp/jjj> Get-PsResourceRepository
Name Uri Trusted Priority IsAllowedByPolicy
---- --- ------- -------- -----------------
MAR https://mcr.microsoft.com/ True 40 True
PSGallery https://www.powershellgallery.com/api/v2 False 50 True
PS /tmp/jjj> Save-PsResource -name az -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Value of isRepositoryUnauthenticated: True
PS /tmp/jjj> Save-PsResource -name azxx -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.
Save-PSResource: Package(s) 'azxx' could not be installed from registered repositories 'MAR, PSGallery'.
PS /tmp/jjj> Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.
Information level message on every container registry server API call
| _cmdletPassedIn.WriteInformation($"Value of isRepositoryUnauthenticated: {isRepositoryUnauthenticated}", new string[] { "PSRGContainerRegistryUnauthenticatedCheck" }); |
PSResourceGet/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1
Line 364 in 5b65686
| $RegistryUnauthenticated[0].MessageData | Should -Be "Value of isRepositoryUnauthenticated: False" |
- Information level is being used to pass information to unit test(s)
Container registry server 404 error messages are emitted Cmdlet
in the log MAR API is returning 404 package names "azxxx" and "FormatMarkdownTable" which is normal but the because azxxx does not exist at all and FormatMarkdownTable is available only on powershell gallery. As user I don't need that kind of error messages. IMO error should be handled between Cmdlet and API call logic
Expected behavior
No misleading error messages or test related messages on information levelActual behavior
-Error details
Get-Error
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
TargetSite :
Name : MoveNext
DeclaringType : [Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls+<SendRequestAsync>d__63]
MemberType : Method
Module : Microsoft.PowerShell.PSResourceGet.dll
Message : Response returned status code package: Not Found.
Source : Microsoft.PowerShell.PSResourceGet
HResult : -2146233088
StackTrace :
at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.SendRequestAsync(HttpRequestMessage message) in C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 1167
at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.GetHttpResponseJObjectUsingDefaultHeaders(String url, HttpMethod method, Collection`1 defaultHeaders, ErrorRecord& errRecord, Boolean usePagination) in
C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 969
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
CategoryInfo : InvalidResult: (Microsoft.PowerShel…lets.SavePSResource:SavePSResource) [Save-PSResource], ResourceNotFoundException
FullyQualifiedErrorId : ResourceNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
InvocationInfo :
MyCommand : Save-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 15
Line : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
Statement : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
PositionMessage : At line:1 char:1
+ Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -S …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Save-PsResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
0
1Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.2.0 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}
Key : PSVersion
Value : 7.6.1
Name : PSVersion
Key : PSEdition
Value : Core
Name : PSEdition
Key : GitCommitId
Value : 7.6.1
Name : GitCommitId
Key : OS
Value : macOS 26.3.1
Name : OS
Key : Platform
Value : Unix
Name : Platform
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name : PSCompatibleVersions
Key : PSRemotingProtocolVersion
Value : 2.4
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersionVisuals
No response
Reactions are currently unavailable
Metadata
Metadata
Labels
No labels
Activity