Skip to content

Commit 077179c

Browse files
committed
Fix Icinga 2 .conf file generator
Fixes Get-IcingaCheckCommandConfig -IcingaConfig generates invalid configuration file #181
1 parent c7d0a92 commit 077179c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2020
* [#189](https://github.com/Icinga/icinga-powershell-framework/pull/189) Fixes wrong documented user group for accessing Performance Counter objects which should be `Performance Monitor Users`
2121
* [#192](https://github.com/Icinga/icinga-powershell-framework/pull/192) Fixes code base for `Invoke-IcingaCheckService` by preferring to fetch the startup type of services by using WMI instead of `Get-Services`, as the result of `Get-Services` might be empty in some cases
2222
* [#195](https://github.com/Icinga/icinga-powershell-framework/pull/195) Fix Agent installer crash on package lookup with different files in directory
23+
* [#196](https://github.com/Icinga/icinga-powershell-framework/pull/196) Fix Icinga 2 .conf file generator to no longer generate invalid plain configuration files
2324
* [#197](https://github.com/Icinga/icinga-powershell-framework/pull/197) Fixes progress bar appearance on check outputs for certain plugins, by disabling the entire PowerShell progress bar during the usage of Icinga for Windows
2425

2526
## 1.3.0 (2020-12-01)

lib/core/tools/Get-IcingaCheckCommandConfig.psm1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ function Write-IcingaPlainConfigurationFiles()
430430
foreach ($argconfig in $CheckArgument.Keys) {
431431
$Value = '';
432432

433+
if ($argconfig -eq 'set_if_format') {
434+
continue;
435+
}
436+
433437
# Order is numeric -> no "" required
434438
if ($argconfig -eq 'order') {
435439
$StringFormater = ' {0} = {1}{2}';
@@ -467,6 +471,7 @@ function Write-IcingaPlainConfigurationFiles()
467471
break;
468472
}
469473
$Description = $DataField.description.Replace("`r`n", ' ');
474+
$Description = $Description.Replace("\", '\\');
470475
$Description = $Description.Replace("`n", ' ');
471476
$Description = $Description.Replace("`r", ' ');
472477
$Description = $Description.Replace('"', "'");
@@ -497,8 +502,8 @@ function Write-IcingaPlainConfigurationFiles()
497502
$IcingaConfig += New-IcingaNewLine;
498503

499504
foreach ($var in $CheckCommand.vars.Keys) {
500-
$Value = $CheckCommand.vars[$var];
501-
$IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value, (New-IcingaNewLine));
505+
[string]$Value = $CheckCommand.vars[$var];
506+
$IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value.ToLower(), (New-IcingaNewLine));
502507
}
503508
} else {
504509
$IcingaConfig += New-IcingaNewLine;

0 commit comments

Comments
 (0)