From 90ef20a7e5deeae82177adad24878ee745570f33 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Wed, 25 Mar 2020 22:28:54 +0100 Subject: [PATCH] Fixes debug/daemon mode while loading libs only --- icinga-powershell-framework.psm1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/icinga-powershell-framework.psm1 b/icinga-powershell-framework.psm1 index f29560c..e0e52e7 100644 --- a/icinga-powershell-framework.psm1 +++ b/icinga-powershell-framework.psm1 @@ -53,6 +53,18 @@ function Use-Icinga() 'DebugMode' = $DebugMode; } ); + } else { + # This will fix the debug mode in case we are only using Libs + # without any other variable content and daemon handling + if ($null -eq $global:IcingaDaemonData) { + $global:IcingaDaemonData = [hashtable]::Synchronized(@{}); + } + if ($global:IcingaDaemonData.ContainsKey('DebugMode') -eq $FALSE) { + $global:IcingaDaemonData.DebugMode = $DebugMode; + } + if ($global:IcingaDaemonData.ContainsKey('FrameworkRunningAsDaemon') -eq $FALSE) { + $global:IcingaDaemonData.FrameworkRunningAsDaemon = $Daemon; + } } }