From a29d66dbd9949ef4ae3ce7460218d00bc9b642e5 Mon Sep 17 00:00:00 2001 From: LordHepipud Date: Mon, 7 Aug 2023 20:02:58 +0200 Subject: [PATCH] Fixes config writer publishing invalid Icinga plain config --- doc/100-General/10-Changelog.md | 8 ++++++++ lib/core/tools/Get-IcingaCheckCommandConfig.psm1 | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index de28b59..2fc26e2 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -7,6 +7,14 @@ documentation before upgrading to a new release. Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed). +## 1.11.1 (tbd) + +[Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/29) + +### Bugfixes + +* [#659](https://github.com/Icinga/icinga-powershell-framework/pull/659) Fixes configuration writer which publishes invalid Icinga plain configuration files + ## 1.11.0 (2023-08-01) [Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/26) diff --git a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 index 2f05688..f65f695 100644 --- a/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 +++ b/lib/core/tools/Get-IcingaCheckCommandConfig.psm1 @@ -666,7 +666,11 @@ function Write-IcingaPlainConfigurationFiles() $AddNewLine = $FALSE; } [string]$Value = $CheckCommand.vars[$var]; - $IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value.ToLower(), (New-IcingaNewLine)); + if ($CheckCommand.vars[$var] -Is [bool]) { + $IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value.ToLower(), (New-IcingaNewLine)); + } else { + $IcingaConfig += [string]::Format(' vars.{0} = "{1}"{2}', $var, $Value.ToLower(), (New-IcingaNewLine)); + } } } } else {