Merge pull request #196 from Icinga/fix/icinga2_conf_file_generator_prints_invalid_config

Fix: Icinga 2 .conf file generator is generating invalid files
This commit is contained in:
Lord Hepipud 2021-02-03 11:48:10 +01:00 committed by GitHub
commit 059fceac4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#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`
* [#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
* [#195](https://github.com/Icinga/icinga-powershell-framework/pull/195) Fix Agent installer crash on package lookup with different files in directory
* [#196](https://github.com/Icinga/icinga-powershell-framework/pull/196) Fix Icinga 2 .conf file generator to no longer generate invalid plain configuration files
* [#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
## 1.3.0 (2020-12-01)

View file

@ -430,6 +430,10 @@ function Write-IcingaPlainConfigurationFiles()
foreach ($argconfig in $CheckArgument.Keys) {
$Value = '';
if ($argconfig -eq 'set_if_format') {
continue;
}
# Order is numeric -> no "" required
if ($argconfig -eq 'order') {
$StringFormater = ' {0} = {1}{2}';
@ -467,6 +471,7 @@ function Write-IcingaPlainConfigurationFiles()
break;
}
$Description = $DataField.description.Replace("`r`n", ' ');
$Description = $Description.Replace("\", '\\');
$Description = $Description.Replace("`n", ' ');
$Description = $Description.Replace("`r", ' ');
$Description = $Description.Replace('"', "'");
@ -497,8 +502,8 @@ function Write-IcingaPlainConfigurationFiles()
$IcingaConfig += New-IcingaNewLine;
foreach ($var in $CheckCommand.vars.Keys) {
$Value = $CheckCommand.vars[$var];
$IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value, (New-IcingaNewLine));
[string]$Value = $CheckCommand.vars[$var];
$IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value.ToLower(), (New-IcingaNewLine));
}
} else {
$IcingaConfig += New-IcingaNewLine;