From 906d616966e5e5664afe10e732295cba4b5d5e2f Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Wed, 17 Aug 2022 14:52:40 +0200 Subject: [PATCH] Fixes null-value exception on missing background daemons --- doc/100-General/10-Changelog.md | 1 + lib/daemon/Get-IcingaBackgroundDaemons.psm1 | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 3f44b75c..2e69d573 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes +* [#476](https://github.com/Icinga/icinga-powershell-framework/pull/476) Fixes exception `You cannot call a method on va null-valued expression` during installation in case no background daemon is configured * [#529](https://github.com/Icinga/icinga-powershell-framework/pull/529) Fixes package manifest reader for Icinga for Windows components on Windows 2012 R2 and older * [#523](https://github.com/Icinga/icinga-powershell-framework/pull/523) Fixes errors on encapsulated PowerShell calls for missing Cmdlets `Write-IcingaConsoleError` and `Optimize-IcingaForWindowsMemory` * [#524](https://github.com/Icinga/icinga-powershell-framework/issues/524) Fixes uninstallation process by improving the location handling of PowerShell instances with Icinga IMC or Shell diff --git a/lib/daemon/Get-IcingaBackgroundDaemons.psm1 b/lib/daemon/Get-IcingaBackgroundDaemons.psm1 index 279f478d..ee8d7035 100644 --- a/lib/daemon/Get-IcingaBackgroundDaemons.psm1 +++ b/lib/daemon/Get-IcingaBackgroundDaemons.psm1 @@ -1,13 +1,12 @@ function Get-IcingaBackgroundDaemons() { - $Daemons = Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.EnabledDaemons'; + $Daemons = Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.EnabledDaemons'; + [hashtable]$Output = @{ }; if ($null -eq $Daemons) { - return $null; + return $Output; } - [hashtable]$Output = @{ }; - foreach ($daemon in $Daemons.PSObject.Properties) { $Arguments = @{ };