Skip to content

Commit 0851e89

Browse files
George GelashviliidoruXenoPhex
committed
Remove Stop-Computer from PostReboot
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 bb07093) [#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>
1 parent 3fd645d commit 0851e89

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

stemcell-automation/AutomationHelpers.Tests.ps1

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,16 @@ Describe "PostReboot" {
6161
$postRebootCalls.IndexOf("CleanUpVM") | Should -BeLessThan $postRebootCalls.IndexOf("SysprepVM")
6262
}
6363

64-
It "syspreps right before shutting the VM down" {
64+
It "syspreps as the last command" {
6565
PostReboot -Organization "org" -Owner "owner" -SkipRandomPassword:$false
6666
Assert-MockCalled -CommandName SysprepVM
6767
Assert-MockCalled -CommandName SysprepVM -ParameterFilter {
6868
$Organization -eq "org" -and
6969
$Owner -eq "owner" -and
7070
$SkipRandomPassword -eq $false
7171
}
72-
$postRebootCalls.IndexOf("SysprepVM") | Should -BeLessThan $postRebootCalls.IndexOf("Stop-Computer")
73-
}
74-
75-
It "powers off VM last" {
76-
PostReboot
77-
78-
Assert-MockCalled -CommandName Stop-Computer
7972
$lastIndex = $postRebootCalls.Count - 1
80-
$postRebootCalls.IndexOf("Stop-Computer") | Should -Be $lastIndex
73+
$postRebootCalls.IndexOf("SysprepVM") | Should -Be $lastIndex
8174
}
8275
}
8376

stemcell-automation/AutomationHelpers.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ function PostReboot
3737
InstallCFCell
3838
CleanUpVM
3939
SysprepVM -Organization $Organization -Owner $Owner -SkipRandomPassword $SkipRandomPassword
40-
Write-Log "Completed Sysprep. About to poweroff VM..."
41-
Stop-Computer
4240
}
4341

4442
function CopyPSModules

0 commit comments

Comments
 (0)