Skip to content

Commit 64f0db5

Browse files
authored
Remove Error Recording for The Expected Cases in Az.Tools.Installer (#22940)
1 parent d1899d9 commit 64f0db5

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

tools/Az.Tools.Installer/Az.Tools.Installer.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ function Get-RepositoryUrl {
423423
}
424424
}
425425

426-
$exportedFunctions = @( Get-ChildItem -Path $PSScriptRoot/exports/*.ps1 -Recurse -ErrorAction SilentlyContinue )
427-
$internalFunctions = @( Get-ChildItem -Path $PSScriptRoot/internal/*.ps1 -ErrorAction SilentlyContinue )
426+
$exportedFunctions = @( Get-ChildItem -Path $PSScriptRoot/exports/*.ps1 -Recurse -ErrorAction 'SilentlyContinue' )
427+
$internalFunctions = @( Get-ChildItem -Path $PSScriptRoot/internal/*.ps1 -ErrorAction 'SilentlyContinue' )
428428

429429
$allFunctions = $internalFunctions + $exportedFunctions
430430
foreach ($function in $allFunctions) {

tools/Az.Tools.Installer/exports/Uninstall-AzModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function Uninstall-AzModule {
7272
}
7373

7474
if ($Force -or $PSCmdlet.ShouldProcess('Remove Az if installed', 'Az', 'Remove')) {
75-
Uninstall-Module -Name 'Az' -AllVersion -ErrorAction SilentlyContinue -ErrorVariable +errorRecords
75+
Uninstall-Module -Name 'Az' -AllVersion -ErrorAction 'SilentlyContinue'
7676
}
7777

7878
Write-Progress -Id $script:FixProgressBarId "Check currently installed Az modules."

tools/Az.Tools.Installer/exports/Update-AzModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Update-AzModule {
119119
}
120120

121121
if ($Force -or $PSCmdlet.ShouldProcess('Remove Az if installed', 'Az', 'Remove')) {
122-
Uninstall-Module -Name 'Az' -AllVersion -ErrorAction SilentlyContinue -ErrorVariable +errorRecords
122+
Uninstall-Module -Name 'Az' -AllVersion -ErrorAction 'SilentlyContinue'
123123
}
124124

125125
if ($moduleUpdateTable) {

tools/Az.Tools.Installer/internal/Add-RepositoryArgumentCompleter.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ function Add-RepositoryArgumentCompleter()
2424

2525
try
2626
{
27-
if(Get-Command -Name Register-ArgumentCompleter -ErrorAction SilentlyContinue)
27+
if(Get-Command -Name Register-ArgumentCompleter -ErrorAction 'SilentlyContinue')
2828
{
2929
Register-ArgumentCompleter -CommandName $cmdlets -ParameterName $parameterName -ScriptBlock {
3030
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
3131

32-
Get-PSRepository -Name "$wordTocomplete*"-ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Foreach-Object {
32+
Get-PSRepository -Name "$wordTocomplete*"-ErrorAction 'SilentlyContinue' -WarningAction 'SilentlyContinue' | Foreach-Object {
3333
[System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, 'ParameterValue', $_.Name)
3434
}
3535
}

tools/Az.Tools.Installer/internal/Install-AzModuleInternal.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function Install-AzModuleInternal {
6565
$null = Microsoft.PowerShell.Management\New-Item -ItemType Directory -Path $tempRepo -WhatIf:$false -ErrorVariable errorRecords
6666
Write-Debug "[$Invoker] The repository folder $tempRepo is created."
6767

68-
PowerShellGet\Unregister-PSRepository -Name $script:AzTempRepoName -ErrorAction 'SilentlyContinue' -ErrorVariable errorRecords
68+
PowerShellGet\Unregister-PSRepository -Name $script:AzTempRepoName -ErrorAction 'SilentlyContinue'
6969
PowerShellGet\Register-PSRepository -Name $script:AzTempRepoName -SourceLocation $tempRepo -ErrorAction 'Stop' -ErrorVariable errorRecords
7070
PowerShellGet\Set-PSRepository -Name $script:AzTempRepoName -InstallationPolicy Trusted -ErrorVariable errorRecords
7171
Write-Debug "[$Invoker] The temporary repository $script:AzTempRepoName is registered."
@@ -171,7 +171,7 @@ function Install-AzModuleInternal {
171171
Import-Module PackageManagement
172172
Import-Module PowerShellGet -MinimumVersion 2.1.3 -MaximumVersion 3.0.0.0 -Scope Global
173173
if ($RemovePrevious) {
174-
PowerShellGet\Uninstall-Module -Name $moduleName -AllVersion -AllowPrerelease -ErrorAction 'SilentlyContinue' -ErrorVariable +errorRecords
174+
PowerShellGet\Uninstall-Module -Name $moduleName -AllVersion -AllowPrerelease -ErrorAction 'SilentlyContinue'
175175
}
176176
PowerShellGet\Install-Module @installModuleParam -Name $moduleName -RequiredVersion "$moduleVersion" -ErrorVariable +errorRecords
177177
$state = "succeeded"

tools/Az.Tools.Installer/internal/Install-AzModule_ByPath.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Install-AzModule_ByPath {
5555
}
5656

5757
if ($Force -or $PSCmdlet.ShouldProcess('Remove Az if installed', 'Az', 'Remove')) {
58-
PowerShellGet\Uninstall-Module -Name 'Az' -AllVersion -AllowPrerelease -ErrorAction SilentlyContinue -ErrorVariable +errorRecords
58+
PowerShellGet\Uninstall-Module -Name 'Az' -AllVersion -AllowPrerelease -ErrorAction 'SilentlyContinue'
5959
}
6060

6161
try {
@@ -70,7 +70,7 @@ function Install-AzModule_ByPath {
7070
$null = Microsoft.PowerShell.Management\New-Item -ItemType Directory -Path $tempRepo -WhatIf:$false -ErrorVariable +errorRecords
7171
Write-Debug "[$Invoker] The repository folder $tempRepo is created."
7272

73-
PowerShellGet\Unregister-PSRepository -Name $script:AzTempRepoName -ErrorAction 'SilentlyContinue' -ErrorVariable +errorRecords
73+
PowerShellGet\Unregister-PSRepository -Name $script:AzTempRepoName -ErrorAction 'SilentlyContinue'
7474
PowerShellGet\Register-PSRepository -Name $script:AzTempRepoName -SourceLocation $tempRepo -ErrorAction 'Stop' -ErrorVariable +errorRecords
7575
PowerShellGet\Set-PSRepository -Name $script:AzTempRepoName -InstallationPolicy Trusted -ErrorVariable +errorRecords
7676
Write-Debug "[$Invoker] The temporary repository $script:AzTempRepoName is registered."

tools/Az.Tools.Installer/internal/Install-AzModule_Default.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function Install-AzModule_Default {
9999
}
100100

101101
if ($Force -or $PSCmdlet.ShouldProcess('Remove Az if installed', 'Az', 'Remove')) {
102-
PowerShellGet\Uninstall-Module -Name 'Az' -AllVersion -AllowPrerelease -ErrorAction SilentlyContinue -ErrorVariable +errorRecords
102+
PowerShellGet\Uninstall-Module -Name 'Az' -AllVersion -AllowPrerelease -ErrorAction 'SilentlyContinue'
103103
}
104104

105105
if ($modules) {

0 commit comments

Comments
 (0)