mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Handle deprecated argument --key for Icinga Agent save-cert cmd
Fixes #62
This commit is contained in:
parent
858a45bf30
commit
4f8b51ce78
1 changed files with 13 additions and 5 deletions
|
|
@ -48,11 +48,19 @@ function Install-IcingaAgentCertificates()
|
||||||
|
|
||||||
Write-Host ([string]::Format('Fetching trusted master certificate from "{0}"', $Endpoint));
|
Write-Host ([string]::Format('Fetching trusted master certificate from "{0}"', $Endpoint));
|
||||||
|
|
||||||
$arguments = [string]::Format('pki save-cert --key {0}{1}.key --trustedcert {0}trusted-parent.crt --host {2}',
|
# Argument --key for save-cert is deprecated starting with Icinga 2.12.0
|
||||||
$CertificateDirectory,
|
if (Compare-IcingaVersions -RequiredVersion '2.12.0') {
|
||||||
$Hostname,
|
$arguments = [string]::Format('pki save-cert --trustedcert {0}trusted-parent.crt --host {1}',
|
||||||
$Endpoint
|
$CertificateDirectory,
|
||||||
);
|
$Endpoint
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$arguments = [string]::Format('pki save-cert --key {0}{1}.key --trustedcert {0}trusted-parent.crt --host {2}',
|
||||||
|
$CertificateDirectory,
|
||||||
|
$Hostname,
|
||||||
|
$Endpoint
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ((Start-IcingaAgentCertificateProcess -Arguments $arguments) -eq $FALSE) {
|
if ((Start-IcingaAgentCertificateProcess -Arguments $arguments) -eq $FALSE) {
|
||||||
Write-Host 'Unable to connect to your provided Icinga CA. Please verify the entered configuration is correct.' `
|
Write-Host 'Unable to connect to your provided Icinga CA. Please verify the entered configuration is correct.' `
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue