Skip to content

Commit a2ba312

Browse files
authored
Merge pull request #686 from Icinga:fix/adds_certutil_output_and_improves_error_message
Fix: Certutil error handling and message output in case the icingaforwindows.pfx could not be created Fixes certutil error handling and message output in case the icingaforwindows.pfx could not be created
2 parents 173161c + 324aea0 commit a2ba312

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1414
### Bugfixes
1515

1616
* [#683](https://github.com/Icinga/icinga-powershell-framework/pull/683) Fixes JEA installer to exclude domain from user name length check, which can easily exceed the Windows 20 digits username limit
17+
* [#686](https://github.com/Icinga/icinga-powershell-framework/pull/686) Fixes certutil error handling and message output in case the icingaforwindows.pfx could not be created
1718

1819
### Enhancements
1920

lib/webserver/ConvertTo-IcingaX509Certificate.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ function ConvertTo-IcingaX509Certificate()
4444
[string]::Format(
4545
'Certutil merge request has been completed. Certutil message:{0}{0}{1}',
4646
(New-IcingaNewLine),
47-
$CertUtilOutput
47+
($CertUtilOutput | Out-String)
4848
)
4949
);
5050

5151
# If no target file exists afterwards (a valid PFX certificate)
5252
# then throw an exception
5353
if (-Not (Test-Path $TargetFile)) {
54-
throw 'The specified/created certificate file could not be found.';
54+
[string]$ErrMessage = [string]::Format('Unable to create the Icinga for Windows certificate file "icingaforwindows.pfx". Certutil output:{0}{1}', (New-IcingaNewLine), ($CertUtilOutput | Out-String));
55+
Write-IcingaConsoleError $ErrMessage;
56+
throw $ErrMessage;
5557
}
5658

5759
# Now load the actual certificate from the path

0 commit comments

Comments
 (0)