Merge pull request #169 from Icinga:fix/icinga_plain_config_generation

Fix: Small fix for Icinga .conf generation
This commit is contained in:
Lord Hepipud 2020-11-25 12:34:35 +01:00 committed by GitHub
commit b24ebd8baf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -466,7 +466,11 @@ function Write-IcingaPlainConfigurationFiles()
if ([string]::IsNullOrEmpty($DataField.description)) { if ([string]::IsNullOrEmpty($DataField.description)) {
break; break;
} }
$IcingaConfig += [string]::Format(' description = "{0}"{1}', $DataField.description.Replace("`r`n", ''), (New-IcingaNewLine)); $Description = $DataField.description.Replace("`r`n", ' ');
$Description = $Description.Replace("`n", ' ');
$Description = $Description.Replace("`r", ' ');
$Description = $Description.Replace('"', "'");
$IcingaConfig += [string]::Format(' description = "{0}"{1}', $Description, (New-IcingaNewLine));
break; break;
} }
} }
@ -481,6 +485,8 @@ function Write-IcingaPlainConfigurationFiles()
$IcingaConfig += New-IcingaNewLine; $IcingaConfig += New-IcingaNewLine;
} }
$IcingaConfig = $IcingaConfig.Substring(0, $IcingaConfig.Length - 2);
# Close all arguments content # Close all arguments content
$IcingaConfig += New-IcingaNewLine; $IcingaConfig += New-IcingaNewLine;
$IcingaConfig += ' }' $IcingaConfig += ' }'
@ -494,6 +500,8 @@ function Write-IcingaPlainConfigurationFiles()
$Value = $CheckCommand.vars[$var]; $Value = $CheckCommand.vars[$var];
$IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value, (New-IcingaNewLine)); $IcingaConfig += [string]::Format(' vars.{0} = {1}{2}', $var, $Value, (New-IcingaNewLine));
} }
} else {
$IcingaConfig += New-IcingaNewLine;
} }
# Close the CheckCommand object # Close the CheckCommand object