From eb81a12963bed2f1f72395bdca89e6d5c5b32a83 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Mon, 31 May 2021 15:39:52 +0200 Subject: [PATCH] Fix double colon if added by check --- lib/icinga/plugin/New-IcingaCheck.psm1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/icinga/plugin/New-IcingaCheck.psm1 b/lib/icinga/plugin/New-IcingaCheck.psm1 index 06a48a4..3f6c82f 100644 --- a/lib/icinga/plugin/New-IcingaCheck.psm1 +++ b/lib/icinga/plugin/New-IcingaCheck.psm1 @@ -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 );