Merge pull request #571 from Icinga:fix/get-help_for_plugin_not_installed_causes_stacktraces_in_icinga_output

Fix: StackTrace in plugin output, when plugin is not installed

Caused by newly introduced `Get-Help` check to fetch argument types
This commit is contained in:
Lord Hepipud 2022-08-28 11:31:23 +02:00 committed by GitHub
commit 1ef7120201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,12 @@ function ConvertTo-IcingaPowerShellArguments()
return @{ };
}
$CommandHelp = Get-Help -Name $Command -Full;
$CommandHelp = Get-Help -Name $Command -Full -ErrorAction SilentlyContinue;
# Ensure we do not cause exceptions along the border in case the plugin is not installed
if ($null -eq $CommandHelp) {
return @{ };
}
[hashtable]$IcingaArguments = @{ };
[int]$ArgumentIndex = 0;