From cc5957001cb15db4c536f25af85cc77753a02e7f Mon Sep 17 00:00:00 2001 From: Klaus Frank Date: Sun, 18 Aug 2019 22:05:33 +0200 Subject: [PATCH] win_domain reboot required exception incorrectly reported (#60496) * Set reboot required dependent on exception message. * Use exception id instead of it's message --- lib/ansible/modules/windows/win_domain.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/windows/win_domain.ps1 b/lib/ansible/modules/windows/win_domain.ps1 index de31134ba7d..546799b7063 100644 --- a/lib/ansible/modules/windows/win_domain.ps1 +++ b/lib/ansible/modules/windows/win_domain.ps1 @@ -124,10 +124,10 @@ if (-not $forest) { } catch [Microsoft.DirectoryServices.Deployment.DCPromoExecutionException] { # ExitCode 15 == 'Role change is in progress or this computer needs to be restarted.' # DCPromo exit codes details can be found at https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/troubleshooting-domain-controller-deployment - if ($_.Exception.ExitCode -eq 15) { + if ($_.Exception.ExitCode -in @(15, 19)) { $result.reboot_required = $true } else { - Fail-Json -obj $result -message "Failed to install ADDSForest with DCPromo: $($_.Exception.Message)" + Fail-Json -obj $result -message "Failed to install ADDSForest, DCPromo exited with $($_.Exception.ExitCode): $($_.Exception.Message)" } }