From 3be6029612c4a8c58ed24c78d12e04854130c2c5 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Tue, 20 Feb 2018 14:46:44 +0100
Subject: [PATCH] WIP: update configuration files if criteria met.

After validating the config files we can now safely trigger the update
if necessary.

Refers to #18, #28
---
 Updater/Update-Service.ps1 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1
index d2f4667..f5de665 100644
--- a/Updater/Update-Service.ps1
+++ b/Updater/Update-Service.ps1
@@ -600,6 +600,23 @@ if (-Not ($ConfigValid)) {
     Exit
 }
 
+
+# reaching this point means
+#    (1) something needs to be updated (config, service or both)
+#  AND
+#    (2) the configuration validates with the corresponding service version
+$UpdSummary = ""
+
+if ($ConfigShouldBeUpdated) {
+    $ConfigUpdated = Update-Configuration
+    if (-Not $ConfigUpdated) {
+        Log-Error "Updating the configuration failed, $($Me) terminating!"
+        Exit
+    }
+    $UpdSummary += "The configuration files were updated.`n"
+}
+
+
 Exit
 
 $ServiceUpdated = Update-ServiceBinaries
-- 
GitLab