Improves plugin output on verbosity levels

Fixes #99
This commit is contained in:
Lord Hepipud 2020-08-13 17:54:00 +02:00
parent 8076a373f5
commit 564711c1b6
2 changed files with 12 additions and 4 deletions

View file

@ -22,6 +22,7 @@ Check Command configuration generated by Icinga for Windows 1.2.0 require Icinga
### Notes ### Notes
* Improved documentation for plenty of Cmdlets and functionality * Improved documentation for plenty of Cmdlets and functionality
* We have updated the handling for plugin outputs which will now only print `non Ok` values by using verbosity 0 on check plugin configuration and include `Ok` checks for packages with `non Ok` checks on verbosity 1. Additional details can be found on issue [#99](https://github.com/Icinga/icinga-powershell-framework/issues/99)
* [#80](https://github.com/Icinga/icinga-powershell-framework/issues/80) Adds wrapper function `Get-IcingaWindowsInformation` for WMI and CIM calls to properly handle config/permission errors * [#80](https://github.com/Icinga/icinga-powershell-framework/issues/80) Adds wrapper function `Get-IcingaWindowsInformation` for WMI and CIM calls to properly handle config/permission errors
* [#93](https://github.com/Icinga/icinga-powershell-framework/issues/93) Adds PSScriptAnalyzer for improved and identical code quality * [#93](https://github.com/Icinga/icinga-powershell-framework/issues/93) Adds PSScriptAnalyzer for improved and identical code quality
@ -34,6 +35,7 @@ Check Command configuration generated by Icinga for Windows 1.2.0 require Icinga
* [#94](https://github.com/Icinga/icinga-powershell-framework/issues/94) Adds `Namespace` argument for Get-IcingaWindowsInformation for additional filtering * [#94](https://github.com/Icinga/icinga-powershell-framework/issues/94) Adds `Namespace` argument for Get-IcingaWindowsInformation for additional filtering
* [#95](https://github.com/Icinga/icinga-powershell-framework/issues/95) Improves error handling for issues by using `Use-Icinga` initialising or by calling plugins which are not installed * [#95](https://github.com/Icinga/icinga-powershell-framework/issues/95) Improves error handling for issues by using `Use-Icinga` initialising or by calling plugins which are not installed
* [#98](https://github.com/Icinga/icinga-powershell-framework/issues/98) Adds support for SecureString as password argument on config generation * [#98](https://github.com/Icinga/icinga-powershell-framework/issues/98) Adds support for SecureString as password argument on config generation
* [#99](https://github.com/Icinga/icinga-powershell-framework/issues/99) Improves plugin output with different verbosity settings
### Bugfixes ### Bugfixes

View file

@ -269,9 +269,15 @@ function New-IcingaCheckPackage()
[hashtable]$MessageOrdering = @{}; [hashtable]$MessageOrdering = @{};
foreach ($check in $this.checks) { foreach ($check in $this.checks) {
if ([int]$check.exitcode -eq $skipExitCode -And $skipExitCode -ne -1) { if ($this.verbose -eq 0) {
if ([int]$check.exitcode -eq $skipExitCode) {
continue; continue;
} }
} elseif ($this.verbose -eq 1) {
if ([int]$check.exitcode -eq $skipExitCode -And $check.checkpackage) {
continue;
}
}
if ($MessageOrdering.ContainsKey($check.Name) -eq $FALSE) { if ($MessageOrdering.ContainsKey($check.Name) -eq $FALSE) {
$MessageOrdering.Add($check.name, $check); $MessageOrdering.Add($check.name, $check);
@ -296,7 +302,7 @@ function New-IcingaCheckPackage()
} }
$Check | Add-Member -MemberType ScriptMethod -Name 'WriteAllOutput' -Value { $Check | Add-Member -MemberType ScriptMethod -Name 'WriteAllOutput' -Value {
$this.PrintOutputMessageSorted($TRUE, -1); $this.PrintOutputMessageSorted($TRUE, $IcingaEnums.IcingaExitCode.Ok);
} }
$Check | Add-Member -MemberType ScriptMethod -Name 'PrintAllMessages' -Value { $Check | Add-Member -MemberType ScriptMethod -Name 'PrintAllMessages' -Value {
@ -357,7 +363,7 @@ function New-IcingaCheckPackage()
break; break;
}; };
1 { 1 {
# Include the Operator into the check package result # Include the Operator into the check package result and OK checks of package
break; break;
}; };
Default { Default {