diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 0f88674..4f3d332 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -17,6 +17,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Bugfixes +* [#753](https://github.com/Icinga/icinga-powershell-framework/issues/753) Fixes Icinga for Windows config compiler to always use `Switchparameter` for `switch` data types, in case the documentation is not written properly for the plugin * [#781](https://github.com/Icinga/icinga-powershell-framework/issues/781) Fixes Icinga for Windows being stuck during installation while fetching service information over CIM-Instances, if other services are frozen, blocking the CIM-Request * [#784](https://github.com/Icinga/icinga-powershell-framework/issues/784) Fixes Icinga for Windows threshold comparison which wrongly compared warning/critical thresholds for non-range values (like Match) * [#785](https://github.com/Icinga/icinga-powershell-framework/issues/785) Fixes Icinga for Windows freezing during loading in case the `config.json` is empty diff --git a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 index 8d0f672..f59e0dd 100644 --- a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 +++ b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 @@ -231,7 +231,13 @@ function Get-IcingaCheckCommandConfig() [string]$Order = 99 } - $IcingaCustomVariable = [string]::Format('${0}_{1}_{2}$', $PluginNameSpace, (Get-Culture).TextInfo.ToTitleCase($parameter.type.name), $parameter.Name); + [string]$ParameterName = $parameter.type.name; + + if ($ParameterName -eq 'SwitchParameter' -Or $ParameterName -eq 'Switch') { + $ParameterName = 'SwitchParameter'; + } + + $IcingaCustomVariable = [string]::Format('${0}_{1}_{2}$', $PluginNameSpace, (Get-Culture).TextInfo.ToTitleCase($ParameterName), $parameter.Name); if ($IcingaCustomVariable.Length -gt 66) { Write-IcingaConsoleError 'The generated custom variable name for the argument "{0}" and plugin "{1}" is too long. Custom variables are generated by combining the check function name, the datatype of the argument as well as the argument name itself. Please shorten your argument name and/or the check function name. The maximum size of generated custom variables is 64 digits. Current argument size: "{2}", generated custom variable name: "{3}"' -Objects $parameter.Name, $check, ($IcingaCustomVariable.Length - 2), $IcingaCustomVariable.Replace('$', ''); @@ -245,7 +251,7 @@ function Get-IcingaCheckCommandConfig() } # Add arguments to a given command - if ($parameter.type.name -eq 'SwitchParameter') { + if ($parameter.type.name -eq 'SwitchParameter' -Or $parameter.type.name -eq 'Switch') { $Basket.Command[$check].arguments.Add( [string]::Format('-{0}', $parameter.Name), @{ 'set_if' = $IcingaCustomVariable; @@ -317,7 +323,7 @@ function Get-IcingaCheckCommandConfig() ); } - if ($parameter.type.name -eq 'SwitchParameter') { + if ($parameter.type.name -eq 'SwitchParameter' -Or $parameter.type.name -eq 'Switch') { $Basket.Command[$check].vars.ifw_api_arguments.Add([string]::Format('{0}', $parameter.Name), @{ 'set_if' = $IcingaCustomVariable; }); @@ -363,6 +369,8 @@ function Get-IcingaCheckCommandConfig() $IsDataList = $TRUE; } elseif ($parameter.type.name -eq 'SwitchParameter') { $IcingaDataType = 'Boolean'; + } elseif ($parameter.type.name -eq 'Switch') { + $IcingaDataType = 'Boolean'; } elseif ($parameter.type.name -eq 'Object') { $IcingaDataType = 'String'; } elseif ($parameter.type.name -eq 'Array') {