Skip to content

Commit

Permalink
Merge pull request #571 from Icinga:fix/get-help_for_plugin_not_insta…
Browse files Browse the repository at this point in the history
…lled_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
  • Loading branch information
LordHepipud authored Aug 28, 2022
2 parents 6d127a8 + 73dd364 commit 1ef7120
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1ef7120

Please sign in to comment.