From 3be78effe76ecafb2f2c59c902d79fa524186c59 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Thu, 14 Dec 2017 17:17:31 +0100
Subject: [PATCH] Create folder for host-specific logs automatically.

Only check if the base folder exists.
---
 Updater/Update-Service.ps1 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1
index 4cf7d0a..41ef792 100644
--- a/Updater/Update-Service.ps1
+++ b/Updater/Update-Service.ps1
@@ -298,11 +298,13 @@ function Update-ServiceBinaries {
 
 
 function Upload-LogFiles {
+    $Dest = "$($UploadPathLogs)\$($env:COMPUTERNAME)"
+    New-Item -Force -Type Directory $Dest
     try {
         Copy-Item -Force -ErrorAction Stop `
             -Path "$($LogPath)\service.log" `
-            -Destination $UploadPathLogs
-        Log-Debug "Uploaded logfile to [$($UploadPathLogs)]."
+            -Destination $Dest
+        Log-Debug "Uploaded logfile to [$($Dest)]."
     }
     catch {
         Log-Warning "Uploading logfile FAILED!`n$($_.Exception.Message)"
@@ -418,7 +420,7 @@ $UpdPathConfig = "$($UpdateSourcePath)\Configs\$($env:COMPUTERNAME)"
 $UpdPathConfigCommon = "$($UpdateSourcePath)\Configs\_COMMON_"
 $UpdPathMarkerFiles = "$($UpdateSourcePath)\Service\UpdateMarkers"
 $UpdPathBinaries = "$($UpdateSourcePath)\Service\Binaries"
-$UploadPathLogs = "$($UpdateSourcePath)\Logs\$($env:COMPUTERNAME)"
+$UploadPathLogs = "$($UpdateSourcePath)\Logs"
 
 Exit-IfDirMissing $InstallationPath "installation"
 Exit-IfDirMissing $LogPath "log files"
-- 
GitLab