Merge pull request #542 from Icinga:fix/null-value_exception_for_no_background_daemons_configured

Fix: Null-value exception on missing background daemons

Fixes `You cannot call a method on va null-valued expression` during installation or while enabling JEA, in case no background daemons have been configured.
This commit is contained in:
Lord Hepipud 2022-08-17 14:59:12 +02:00 committed by GitHub
commit b7a0d3892d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -13,6 +13,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes ### 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 * [#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` * [#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 * [#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

View file

@ -1,13 +1,12 @@
function Get-IcingaBackgroundDaemons() function Get-IcingaBackgroundDaemons()
{ {
$Daemons = Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.EnabledDaemons'; $Daemons = Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.EnabledDaemons';
[hashtable]$Output = @{ };
if ($null -eq $Daemons) { if ($null -eq $Daemons) {
return $null; return $Output;
} }
[hashtable]$Output = @{ };
foreach ($daemon in $Daemons.PSObject.Properties) { foreach ($daemon in $Daemons.PSObject.Properties) {
$Arguments = @{ }; $Arguments = @{ };