Merge pull request #267 from Icinga:feature/add_colon_if_not_set

Fix: Double colon is added, even if check name already contains it
This commit is contained in:
Lord Hepipud 2021-05-31 15:41:56 +02:00 committed by GitHub
commit 955c2b31f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,10 +114,17 @@ function New-IcingaCheck()
);
}
[bool]$AddColon = $TRUE;
if ([string]::IsNullOrEmpty($this.Name) -eq $FALSE -And $this.Name[$this.Name.Length - 1] -eq ':') {
$AddColon = $FALSE;
}
$this.__CheckOutput = [string]::Format(
'{0} {1}: {2}{3}',
'{0} {1}{2} {3}{4}',
$IcingaEnums.IcingaExitCodeText[$this.__CheckState],
$this.Name,
(&{ if ($AddColon) { return ':'; } else { return ''; } }),
$PluginThresholds,
$TimeSpan
);