Merge pull request #398 from Icinga:fix/remove_stringbuilder_output_from_new_component

Fix: Removes String.Builder output while creating new components

Fixes String.Builder object output, while creating new components by using `New-IcingaForWindowsComponent`
This commit is contained in:
Lord Hepipud 2021-11-10 10:30:43 +01:00 committed by GitHub
commit 6d51f01570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -7,6 +7,14 @@ documentation before upgrading to a new release.
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed). Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed).
## 1.8.0 (2022-02-08)
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/19?closed=1)
### Bugfixes
* [#398](https://github.com/Icinga/icinga-powershell-framework/pull/398) Fixes String.Builder object output, while creating new components by using `New-IcingaForWindowsComponent`
## 1.7.0 (2021-11-09) ## 1.7.0 (2021-11-09)
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/16?closed=1) [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/16?closed=1)

View file

@ -50,17 +50,17 @@ function Write-IcingaForWindowsComponentManifest()
[int]$CurrentIndex = 0; [int]$CurrentIndex = 0;
foreach ($module in $Value) { foreach ($module in $Value) {
$CurrentIndex += 1; $CurrentIndex += 1;
$ContentString.Append('@{ '); $ContentString.Append('@{ ') | Out-Null;
foreach ($dependency in $module.Keys) { foreach ($dependency in $module.Keys) {
$DependencyValue = $module[$dependency]; $DependencyValue = $module[$dependency];
$ContentString.Append([string]::Format("{0} = '{1}'; ", $dependency, $DependencyValue)); $ContentString.Append([string]::Format("{0} = '{1}'; ", $dependency, $DependencyValue)) | Out-Null;
} }
$ContentString.Append('}'); $ContentString.Append('}') | Out-Null;
if ($CurrentIndex -ne $Value.Count) { if ($CurrentIndex -ne $Value.Count) {
$ContentString.Append(",`r`n "); $ContentString.Append(",`r`n ") | Out-Null;
} }
} }
@ -73,7 +73,7 @@ function Write-IcingaForWindowsComponentManifest()
Write-IcingaFileSecure -File (Join-Path -Path $ModuleDir -ChildPath ([string]::Format('{0}.psd1', $ModuleName))) -Value $ManifestFileData; Write-IcingaFileSecure -File (Join-Path -Path $ModuleDir -ChildPath ([string]::Format('{0}.psd1', $ModuleName))) -Value $ManifestFileData;
} }
$ContentString.Clear(); $ContentString.Clear() | Out-Null;
[array]$ManifestContent = Get-Content -Path (Join-Path -Path $ModuleDir -ChildPath ([string]::Format('{0}.psd1', $ModuleName))); [array]$ManifestContent = Get-Content -Path (Join-Path -Path $ModuleDir -ChildPath ([string]::Format('{0}.psd1', $ModuleName)));