From 3d854da218beeaec799e942d79c2e2db2ccf895e Mon Sep 17 00:00:00 2001 From: Alexander Stoll Date: Fri, 13 Sep 2019 15:59:22 +0200 Subject: [PATCH] Used Icinga-DSL for array-arg splitting --- lib/core/tools/Get-IcingaCheckCommandConfig.psm1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 index 3b1f42a..2301c07 100644 --- a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 +++ b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 @@ -211,7 +211,16 @@ function Get-IcingaCheckCommandConfig() } elseif ($parameter.type.name -eq 'array') { $Basket.Command[$Data.Syntax.syntaxItem.Name].arguments.Add( [string]::Format('-{0}', $parameter.Name), @{ - 'value' = [string]::Format('(Split-IcingaCheckCommandArgs {0})', $IcingaCustomVariable); + 'value' = @{ + 'type' = 'Function'; + 'body' = [string]::Format( + 'var arr = macro("{0}");{1}if (len(arr) == 0) {2}{1}return "$null";{1}{3}{1}return arr.join(",");', + $IcingaCustomVariable, + "`r`n", + '{', + '}' + ); + } 'order' = $Order; } );