mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Fixes notice packages to not return unknown and properly report if no entries were found
This commit is contained in:
parent
83cc134c47
commit
3bf61237f1
1 changed files with 5 additions and 1 deletions
|
|
@ -181,13 +181,17 @@ function New-IcingaCheckPackage()
|
||||||
$NotOkChecks = 0;
|
$NotOkChecks = 0;
|
||||||
$OkChecks = 0;
|
$OkChecks = 0;
|
||||||
|
|
||||||
if ($this.__Checks.Count -eq 0 -And $this.IgnoreEmptyPackage -eq $FALSE) {
|
if ($this.__Checks.Count -eq 0 -and ($this.IgnoreEmptyPackage -eq $FALSE -and $this.IsNoticePackage -eq $FALSE)) {
|
||||||
$this.__ErrorMessage = 'No checks added to this package';
|
$this.__ErrorMessage = 'No checks added to this package';
|
||||||
$this.__SetCheckState($IcingaEnums.IcingaExitCode.Unknown);
|
$this.__SetCheckState($IcingaEnums.IcingaExitCode.Unknown);
|
||||||
$this.__SetCheckOutput();
|
$this.__SetCheckOutput();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this.__Checks.Count -eq 0 -and $this.IsNoticePackage) {
|
||||||
|
$this.__ErrorMessage = 'Nothing to report';
|
||||||
|
}
|
||||||
|
|
||||||
[array]$this.__Checks = ($this.__Checks | Sort-Object -Property Name);
|
[array]$this.__Checks = ($this.__Checks | Sort-Object -Property Name);
|
||||||
|
|
||||||
# Loop all checks to understand the content of result
|
# Loop all checks to understand the content of result
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue