From 7a547de3c7f61200ef6f8a00068a6f4583b886f3 Mon Sep 17 00:00:00 2001 From: Flora Gallina-Jones Date: Fri, 6 Mar 2020 18:12:44 -0500 Subject: [PATCH] clarified warning thrown when Windows Root Certificates can't be updated so that Alanas understand what went wrong Co-authored-by: Austina Lin Co-authored-by: Flora Gallina-Jones --- stemcell-automation/AutomationHelpers.Tests.ps1 | 3 --- stemcell-automation/AutomationHelpers.ps1 | 9 --------- stemcell-automation/ProvisionVM.Tests.ps1 | 2 +- stemcell-automation/ProvisionVM.ps1 | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stemcell-automation/AutomationHelpers.Tests.ps1 b/stemcell-automation/AutomationHelpers.Tests.ps1 index 347e3f43..8a96661b 100644 --- a/stemcell-automation/AutomationHelpers.Tests.ps1 +++ b/stemcell-automation/AutomationHelpers.Tests.ps1 @@ -1010,13 +1010,10 @@ Describe "Install-WUCerts" { It "fails gracefully when Get-WUCerts powershell cmdlet fails" { Mock Get-WUCerts { throw "Something went wrong trying to Get-WUCerts" } - Mock Write-Log { } { Install-WUCerts } | Should -Throw "Something went wrong trying to Get-WUCerts" Assert-MockCalled Get-WUCerts -Times 1 -Scope It - Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter {$Message -eq "Something went wrong trying to Get-WUCerts" } - Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter {$Message -eq "Failed to retrieve updated root certificates from the public Windows Update Server." } } } diff --git a/stemcell-automation/AutomationHelpers.ps1 b/stemcell-automation/AutomationHelpers.ps1 index de87aff8..aef192fe 100644 --- a/stemcell-automation/AutomationHelpers.ps1 +++ b/stemcell-automation/AutomationHelpers.ps1 @@ -499,17 +499,8 @@ function Extract-LGPO function Install-WUCerts { - try - { Get-WUCerts Write-Log "Successfully retrieved Windows Update certs" - } - catch [Exception] - { - Write-Log $_.Exception.Message - Write-Log "Failed to retrieve updated root certificates from the public Windows Update Server." - throw $_.Exception - } } function Create-VersionFile diff --git a/stemcell-automation/ProvisionVM.Tests.ps1 b/stemcell-automation/ProvisionVM.Tests.ps1 index 2665fdaf..21d5bdb2 100644 --- a/stemcell-automation/ProvisionVM.Tests.ps1 +++ b/stemcell-automation/ProvisionVM.Tests.ps1 @@ -92,7 +92,7 @@ Describe "ProvisionVM" { Assert-MockCalled Install-WUCerts -Times 1 -Scope It Assert-MockCalled Write-Log -Times 1 -Scope It -ParameterFilter {$Message -eq "Something went wrong trying to Install-WUCerts" } - Assert-MockCalled Write-Warning -Times 1 -Scope It -ParameterFilter {$Message -eq "This should not impact the successful execution of stembuild construct. If the root certificates are out of date, Diego cells running on VMs built off of this stemcell may not be able to make outbound network connections." } + Assert-MockCalled Write-Warning -Times 1 -Scope It -ParameterFilter {$Message -eq "Failed to retrieve updated root certificates from the public Windows Update Server. This should not impact the successful execution of stembuild construct. If your root certificates are out of date, Diego cells running on VMs built from this stemcell may not be able to make outbound network connections." } } diff --git a/stemcell-automation/ProvisionVM.ps1 b/stemcell-automation/ProvisionVM.ps1 index b8b7f794..75063c10 100644 --- a/stemcell-automation/ProvisionVM.ps1 +++ b/stemcell-automation/ProvisionVM.ps1 @@ -21,7 +21,7 @@ function ProvisionVM() { catch [Exception] { Write-Log $_.Exception.Message - Write-Warning "This should not impact the successful execution of stembuild construct. If the root certificates are out of date, Diego cells running on VMs built off of this stemcell may not be able to make outbound network connections." + Write-Warning "Failed to retrieve updated root certificates from the public Windows Update Server. This should not impact the successful execution of stembuild construct. If your root certificates are out of date, Diego cells running on VMs built from this stemcell may not be able to make outbound network connections." } Create-VersionFile -Version $Version Restart-Computer