mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-22 07:39:52 -05:00
Adds exceptions in case source Cert file is missing as argument or invalid
This commit is contained in:
parent
c6dc082081
commit
30a7d6f257
1 changed files with 8 additions and 0 deletions
|
|
@ -6,6 +6,14 @@ function ConvertTo-IcingaX509Certificate()
|
||||||
[switch]$Force = $FALSE
|
[switch]$Force = $FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($CertFile)) {
|
||||||
|
throw 'Please specify a valid path to an existing certificate (.cer, .pem, .cert)';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Test-Path $CertFile) -eq $FALSE) {
|
||||||
|
throw 'The provided path to your certificate was not valid';
|
||||||
|
}
|
||||||
|
|
||||||
# Use an empty password for converted certificates
|
# Use an empty password for converted certificates
|
||||||
$Password = $null;
|
$Password = $null;
|
||||||
# Use a target file to specify if we use temp files or not
|
# Use a target file to specify if we use temp files or not
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue