From 7665a4401e7f0ef9421c8fb1cd016951f2f8af2c Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Thu, 31 Oct 2019 16:36:55 +0100 Subject: [PATCH] Fixes crash on existing service binary file --- .../framework/Get-IcingaFrameworkServiceBinary.psm1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/core/framework/Get-IcingaFrameworkServiceBinary.psm1 b/lib/core/framework/Get-IcingaFrameworkServiceBinary.psm1 index 97c8396..071e7b7 100644 --- a/lib/core/framework/Get-IcingaFrameworkServiceBinary.psm1 +++ b/lib/core/framework/Get-IcingaFrameworkServiceBinary.psm1 @@ -31,6 +31,16 @@ function Get-IcingaFrameworkServiceBinary() Invoke-WebRequest -Uri $FrameworkServiceUrl -UseBasicParsing -OutFile $ZipArchive; + if ((Test-Path $ServiceBin)) { + Write-Host 'Icinga Service Binary already present. Skipping extrating'; + + return @{ + 'FrameworkServiceUrl' = $FrameworkServiceUrl; + 'ServiceDirectory' = $ServiceDirectory; + 'ServiceBin' = $ServiceBin; + }; + } + if ((Expand-IcingaZipArchive -Path $ZipArchive -Destination $ServiceDirectory) -eq $FALSE) { throw 'Failed to expand the downloaded ZIP archive'; }