File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
PowerShell/Module/Private Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -324,28 +324,31 @@ function _configureAmazonLambdaTools
324324{
325325 Write-Host ' Restoring .NET Lambda deployment tool'
326326
327- Write-Verbose - Message ' Installing .NET Global Tool Amazon.Lambda.Tools'
327+ # see if tool is already installed
328+ $amazonLambdaToolsInstalled = & dotnet tool list - g | Select-String - Pattern Amazon.Lambda.Tools - SimpleMatch - Quiet
328329
329330 # When "-Verbose" switch was used this output was not hidden.
330331 # Using stream redirection to force hide all output from the dotnet cli call
331- & dotnet tool install - g Amazon.Lambda.Tools * > & 1 | Out-Null
332-
333- if ($LASTEXITCODE -ne 0 )
332+ if (-not $amazonLambdaToolsInstalled )
334333 {
335- Write-Verbose - Message ' Error installing, attempting to update Amazon.Lambda.Tools'
334+ Write-Verbose - Message ' Installing .NET Global Tool Amazon.Lambda.Tools'
335+ & dotnet tool install - g Amazon.Lambda.Tools * > & 1 | Out-Null
336+ }
337+ else
338+ {
339+ Write-Verbose - Message ' Updating .NET Global Tool Amazon.Lambda.Tools'
336340
337341 # When "-Verbose" switch was used this output was not hidden.
338342 # Using stream redirection to force hide all output from the dotnet cli call
339343 & dotnet tool update - g Amazon.Lambda.Tools * > & 1 | Out-Null
344+ }
340345
341- if ($LASTEXITCODE -ne 0 )
342- {
343- $msg = @"
346+ if ($LASTEXITCODE -ne 0 ) {
347+ $msg = @"
344348Error configuring .NET CLI AWS Lambda deployment tools: $LastExitCode
345349CALLSTACK:$ ( Get-PSCallStack | Out-String )
346350"@
347- throw $msg
348- }
351+ throw $msg
349352 }
350353
351354 $toolsFolder = Join-Path - Path ' ~' - ChildPath ' .dotnet' - AdditionalChildPath ' tools'
You can’t perform that action at this time.
0 commit comments