Skip to content

Commit

Permalink
BREAKING CHANGE: SqlSetup: Restarts node if setup exits with code 3010 (
Browse files Browse the repository at this point in the history
#1536)

- SqlSetup
  - BREAKING CHANGE: Now, unless the parameter SuppressReboot is set to
    $true, the node will be restarted if the setup ends with the error code 3010.
    Previously just a warning message was written (issue #565).
  • Loading branch information
johlju authored May 14, 2020
1 parent 4c0dcc6 commit 1e162d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ in a future release.
`AGTSVCSTARTUPTYPE`. If the parameter `AgtSvcStartupType` is not specified
in the configuration there will be no setup argument added at all
([issue #464](https://github.com/dsccommunity/SqlServerDsc/issues/464)).
- BREAKING CHANGE: Now, unless the parameter `SuppressReboot` is set to
`$true`, the node will be restarted if the setup ends with the
[error code 3010](https://docs.microsoft.com/en-us/previous-versions/tn-archive/bb418811(v=technet.10)#server-setup-fails-with-code-3010).
Previously just a warning message was written ([issue #565](https://github.com/dsccommunity/SqlServerDsc/issues/565)).

### Fixed

Expand Down
5 changes: 4 additions & 1 deletion source/DSCResources/DSC_SqlSetup/DSC_SqlSetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,10 @@ function Set-TargetResource
{
$setupExitMessageRebootRequired = ('{0} {1}' -f $setupExitMessage, ($script:localizedData.SetupSuccessfulRebootRequired))

Write-Warning -Message $setupExitMessageRebootRequired
Write-Verbose -Message $setupExitMessageRebootRequired

# Setup ended with error code 3010 which means reboot is required.
$global:DSCMachineStatus = 1
}
elseif ($processExitCode -ne 0)
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Unit/DSC_SqlSetup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2409,12 +2409,10 @@ try
Context 'When exit code is 3010' {
$mockDynamicSetupProcessExitCode = 3010

Mock -CommandName Write-Warning

It 'Should warn that target node need to restart' {
{ Set-TargetResource @testParameters } | Should -Not -Throw

Assert-MockCalled -CommandName Write-Warning -Exactly -Times 1 -Scope It
$global:DSCMachineStatus | Should -Be 1
}
}

Expand Down

0 comments on commit 1e162d3

Please sign in to comment.