From 577154e363d6445535ccf111ab97ab511a290c60 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Tue, 20 Feb 2018 17:00:31 +0100 Subject: [PATCH] Adapt update wrap-up and message generation to recent changes. Refers to #18, #28 --- Updater/Update-Service.ps1 | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1 index 13fc554..1d2910d 100644 --- a/Updater/Update-Service.ps1 +++ b/Updater/Update-Service.ps1 @@ -617,7 +617,6 @@ if ($ConfigShouldBeUpdated) { Log-Error "Updating the configuration failed, $($Me) terminating!" Exit } - $UpdSummary += "The configuration files were updated.`n" } if ($ServiceShouldBeUpdated) { @@ -628,20 +627,26 @@ if ($ServiceShouldBeUpdated) { } } -Exit +$UpdSummary = "Updated $($UpdItems -join " and ")." -if ($msg -ne "") { - if ($ServiceRunningBefore) { - Log-Debug "Update action occurred, finishing up..." - Start-MyService - } else { - Log-Debug "Not starting the service as it was not running before." - } - Send-MailReport -Subject "Config and / or service has been updated!" ` - -Body $msg + +if ($ServiceRunningBefore) { + Log-Debug "$($UpdSummary) Trying to start the service again..." + Start-MyService +} else { + Log-Debug "$($UpdSummary) Leaving the service stopped, as it was before." +} + +$UpdDetails = $("An $($Me) run completed successfully. Updated items:" + "`n> - $($UpdItems -join "`n> - ")") +if ($ConfigUpdated) { + $UpdDetails += "`n`nConfiguration validation summary:`n$($ConfigSummary)" } +Send-MailReport -Subject "$UpdSummary" -Body "$UpdDetails" + + Upload-LogFiles Log-Debug "$($Me) finished." \ No newline at end of file -- GitLab