Skip to content

Commit

Permalink
Remove Stop-Computer from PostReboot
Browse files Browse the repository at this point in the history
to prevent shutting down too quickly after invoking sysprep, before it
completes.
this is a complementary change to bosh-psmodules use the /shutdown flag
in sysprep.exe for vsphere (bosh-psmodules repo bb07093d)

[#174128738](https://www.pivotaltracker.com/story/show/174128738)
 Update the stemcell creation process to ensure UTC timezone

Co-authored-by: Sam Coward <scoward@pivotal.io>
Co-authored-by: Anand Gaitonde <agaitonde@pivotal.io>
Co-authored-by: Sam Coward <scoward@pivotal.io>
Co-authored-by: Anand Gaitonde <agaitonde@pivotal.io>
Co-authored-by: Sam Coward <scoward@pivotal.io>
Co-authored-by: Anand Gaitonde <agaitonde@pivotal.io>
  • Loading branch information
3 people committed Aug 11, 2020
1 parent 3fd645d commit 0851e89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 2 additions & 9 deletions stemcell-automation/AutomationHelpers.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,16 @@ Describe "PostReboot" {
$postRebootCalls.IndexOf("CleanUpVM") | Should -BeLessThan $postRebootCalls.IndexOf("SysprepVM")
}

It "syspreps right before shutting the VM down" {
It "syspreps as the last command" {
PostReboot -Organization "org" -Owner "owner" -SkipRandomPassword:$false
Assert-MockCalled -CommandName SysprepVM
Assert-MockCalled -CommandName SysprepVM -ParameterFilter {
$Organization -eq "org" -and
$Owner -eq "owner" -and
$SkipRandomPassword -eq $false
}
$postRebootCalls.IndexOf("SysprepVM") | Should -BeLessThan $postRebootCalls.IndexOf("Stop-Computer")
}

It "powers off VM last" {
PostReboot

Assert-MockCalled -CommandName Stop-Computer
$lastIndex = $postRebootCalls.Count - 1
$postRebootCalls.IndexOf("Stop-Computer") | Should -Be $lastIndex
$postRebootCalls.IndexOf("SysprepVM") | Should -Be $lastIndex
}
}

Expand Down
2 changes: 0 additions & 2 deletions stemcell-automation/AutomationHelpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ function PostReboot
InstallCFCell
CleanUpVM
SysprepVM -Organization $Organization -Owner $Owner -SkipRandomPassword $SkipRandomPassword
Write-Log "Completed Sysprep. About to poweroff VM..."
Stop-Computer
}

function CopyPSModules
Expand Down

0 comments on commit 0851e89

Please sign in to comment.