Skip to content

Commit

Permalink
clarified warning thrown when Windows Root Certificates can't be updated
Browse files Browse the repository at this point in the history
so that Alanas understand what went wrong

Co-authored-by: Austina Lin <aulin@pivotal.io>
Co-authored-by: Flora Gallina-Jones <fgallinajones@pivotal.io>
  • Loading branch information
fg-j and austina-lin committed Mar 6, 2020
1 parent e837cf0 commit 7a547de
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
3 changes: 0 additions & 3 deletions stemcell-automation/AutomationHelpers.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
}
}

Expand Down
9 changes: 0 additions & 9 deletions stemcell-automation/AutomationHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stemcell-automation/ProvisionVM.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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." }

}

Expand Down
2 changes: 1 addition & 1 deletion stemcell-automation/ProvisionVM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a547de

Please sign in to comment.