@@ -466,7 +466,11 @@ function Write-IcingaPlainConfigurationFiles()
466466 if ([string ]::IsNullOrEmpty($DataField.description )) {
467467 break ;
468468 }
469- $IcingaConfig += [string ]::Format(' description = "{0}"{1}' , $DataField.description.Replace (" `r`n " , ' ' ), (New-IcingaNewLine ));
469+ $Description = $DataField.description.Replace (" `r`n " , ' ' );
470+ $Description = $Description.Replace (" `n " , ' ' );
471+ $Description = $Description.Replace (" `r " , ' ' );
472+ $Description = $Description.Replace (' "' , " '" );
473+ $IcingaConfig += [string ]::Format(' description = "{0}"{1}' , $Description , (New-IcingaNewLine ));
470474 break ;
471475 }
472476 }
@@ -481,6 +485,8 @@ function Write-IcingaPlainConfigurationFiles()
481485 $IcingaConfig += New-IcingaNewLine ;
482486 }
483487
488+ $IcingaConfig = $IcingaConfig.Substring (0 , $IcingaConfig.Length - 2 );
489+
484490 # Close all arguments content
485491 $IcingaConfig += New-IcingaNewLine ;
486492 $IcingaConfig += ' }'
@@ -494,6 +500,8 @@ function Write-IcingaPlainConfigurationFiles()
494500 $Value = $CheckCommand.vars [$var ];
495501 $IcingaConfig += [string ]::Format(' vars.{0} = {1}{2}' , $var , $Value , (New-IcingaNewLine ));
496502 }
503+ } else {
504+ $IcingaConfig += New-IcingaNewLine ;
497505 }
498506
499507 # Close the CheckCommand object
0 commit comments