From 714827bc0ae046855a5f48e698e007fd0f414f35 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Thu, 13 Feb 2020 10:19:23 +0100 Subject: [PATCH] Adds script termination in case Agent is not installed for Agent Binary fetching --- lib/core/icingaagent/getters/Get-IcingaAgentBinary.psm1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/core/icingaagent/getters/Get-IcingaAgentBinary.psm1 b/lib/core/icingaagent/getters/Get-IcingaAgentBinary.psm1 index 4c4853f..f1fb417 100644 --- a/lib/core/icingaagent/getters/Get-IcingaAgentBinary.psm1 +++ b/lib/core/icingaagent/getters/Get-IcingaAgentBinary.psm1 @@ -1,6 +1,10 @@ function Get-IcingaAgentBinary() { $IcingaRootDir = Get-IcingaAgentRootDirectory; + if ([string]::IsNullOrEmpty($IcingaRootDir)) { + throw 'The Icinga Agent seems not to be installed'; + } + $IcingaBinary = (Join-Path -Path $IcingaRootDir -ChildPath '\sbin\icinga2.exe'); if ((Test-Path $IcingaBinary) -eq $FALSE) {