Fix Icinga 2 .conf file generator

Fixes Get-IcingaCheckCommandConfig -IcingaConfig generates invalid configuration file #181
This commit is contained in:
Lord Hepipud 2021-01-27 15:16:28 +01:00
parent c7d0a923a2
commit 077179ccce
2 changed files with 8 additions and 2 deletions

View file

@ -20,6 +20,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` * [#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 * [#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 * [#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 * [#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) ## 1.3.0 (2020-12-01)

View file

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