Fixes colon at package message and on no message

This commit is contained in:
Lord Hepipud 2021-05-29 12:57:41 +02:00
parent 9b5c64eacb
commit f9012f3094

View file

@ -105,39 +105,39 @@ function New-IcingaCheckPackage()
if ($this.__GetIndention() -eq 0) { if ($this.__GetIndention() -eq 0) {
if ($this.__UnknownChecks.Count -ne 0) { if ($this.__UnknownChecks.Count -ne 0) {
$UnknownChecks = [string]::Format(' [UNKNOWN] {0}', ([string]::Join(', ', $this.__UnknownChecks))); $UnknownChecks = [string]::Format(' [UNKNOWN] {0}', ([string]::Join(', ', $this.__UnknownChecks)));
$HasContent = $TRUE;
$CheckSummary.Append( $CheckSummary.Append(
[string]::Format(' {0} Unknown', $this.__UnknownChecks.Count) [string]::Format(' {0} Unknown', $this.__UnknownChecks.Count)
) | Out-Null; ) | Out-Null;
} }
if ($this.__CriticalChecks.Count -ne 0) { if ($this.__CriticalChecks.Count -ne 0) {
$CriticalChecks = [string]::Format(' [CRITICAL] {0}', ([string]::Join(', ', $this.__CriticalChecks))); $CriticalChecks = [string]::Format(' [CRITICAL] {0}', ([string]::Join(', ', $this.__CriticalChecks)));
$HasContent = $TRUE;
$CheckSummary.Append( $CheckSummary.Append(
[string]::Format(' {0} Critical', $this.__CriticalChecks.Count) [string]::Format(' {0} Critical', $this.__CriticalChecks.Count)
) | Out-Null; ) | Out-Null;
} }
if ($this.__WarningChecks.Count -ne 0) { if ($this.__WarningChecks.Count -ne 0) {
$WarningChecks = [string]::Format(' [WARNING] {0}', ([string]::Join(', ', $this.__WarningChecks))); $WarningChecks = [string]::Format(' [WARNING] {0}', ([string]::Join(', ', $this.__WarningChecks)));
$HasContent = $TRUE;
$CheckSummary.Append( $CheckSummary.Append(
[string]::Format(' {0} Warning', $this.__WarningChecks.Count) [string]::Format(' {0} Warning', $this.__WarningChecks.Count)
) | Out-Null; ) | Out-Null;
} }
} }
if ([string]::IsNullOrEmpty($this.__ErrorMessage) -eq $FALSE) {
$HasContent = $TRUE;
}
if ($this.__OkChecks.Count -ne 0) { if ($this.__OkChecks.Count -ne 0) {
$CheckSummary.Append( $CheckSummary.Append(
[string]::Format(' {0} Ok', $this.__OkChecks.Count) [string]::Format(' {0} Ok', $this.__OkChecks.Count)
) | Out-Null; ) | Out-Null;
$HasContent = $TRUE;
} }
if ($this.AddSummaryHeader -eq $FALSE) { if ($this.AddSummaryHeader -eq $FALSE) {
$CheckSummary.Clear() | Out-Null; $CheckSummary.Clear() | Out-Null;
$CheckSummary.Append('') | Out-Null; $CheckSummary.Append('') | Out-Null;
} elseif ($CheckSummary.Length -ne 0) {
$HasContent = $TRUE;
}
if ([string]::IsNullOrEmpty($this.__ErrorMessage) -eq $FALSE) {
$HasContent = $TRUE;
} }
$this.__CheckOutput = [string]::Format( $this.__CheckOutput = [string]::Format(