Skip to content

Commit 1ef7120

Browse files
authored
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
2 parents 6d127a8 + 73dd364 commit 1ef7120

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ function ConvertTo-IcingaPowerShellArguments()
2525
return @{ };
2626
}
2727

28-
$CommandHelp = Get-Help -Name $Command -Full;
28+
$CommandHelp = Get-Help -Name $Command -Full -ErrorAction SilentlyContinue;
29+
30+
# Ensure we do not cause exceptions along the border in case the plugin is not installed
31+
if ($null -eq $CommandHelp) {
32+
return @{ };
33+
}
2934

3035
[hashtable]$IcingaArguments = @{ };
3136
[int]$ArgumentIndex = 0;

0 commit comments

Comments
 (0)