mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 23:29:40 -05:00
Merge pull request #365 from Icinga:fix/ignore_agent_config_on_install_failure
Fix: Icinga environment corruption on Icinga Agent installation failure In case the Icinga Agent could not be installed, regardless of the reason, we should not write any zone, api or other related config to the environment. By doing so, we can corrupt the environment and make it impossible for the Icinga Agent to be installed in the future, unless we manually delete the folowing directories: * `C:\ProgramData\icinga2` * `C:\Program Files\ICINGA2` * `C:\Program Files (x86)\ICINGA2` (only for x86 installations)
This commit is contained in:
commit
5ae390f0f6
2 changed files with 27 additions and 19 deletions
|
|
@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#361](https://github.com/Icinga/icinga-powershell-framework/issues/361) Fixes IMC freeze on Icinga Director Self-Service installation, in case no Agent installation set on Self-Service API config
|
* [#361](https://github.com/Icinga/icinga-powershell-framework/issues/361) Fixes IMC freeze on Icinga Director Self-Service installation, in case no Agent installation set on Self-Service API config
|
||||||
* [#362](https://github.com/Icinga/icinga-powershell-framework/issues/362) Fixes repository component installation from file share locations
|
* [#362](https://github.com/Icinga/icinga-powershell-framework/issues/362) Fixes repository component installation from file share locations
|
||||||
* [#363](https://github.com/Icinga/icinga-powershell-framework/issues/363) Fixes unneeded continue for JEA process lookup, in case no JEA pid is present
|
* [#363](https://github.com/Icinga/icinga-powershell-framework/issues/363) Fixes unneeded continue for JEA process lookup, in case no JEA pid is present
|
||||||
|
* [#365](https://github.com/Icinga/icinga-powershell-framework/issues/365) Fixes Icinga environment corruption on Icinga Agent installation failure
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,9 @@ function Start-IcingaForWindowsInstallation()
|
||||||
if ($InstallAgent) {
|
if ($InstallAgent) {
|
||||||
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.AgentLocation' -Value $AgentInstallDir;
|
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.AgentLocation' -Value $AgentInstallDir;
|
||||||
Install-IcingaComponent -Name 'agent' -Version $AgentVersion -Confirm -Release;
|
Install-IcingaComponent -Name 'agent' -Version $AgentVersion -Confirm -Release;
|
||||||
|
|
||||||
|
# Only continue this, if our installation was successful
|
||||||
|
if ((Get-IcingaAgentInstallation).Installed) {
|
||||||
Reset-IcingaAgentConfigFile;
|
Reset-IcingaAgentConfigFile;
|
||||||
Move-IcingaAgentDefaultConfig;
|
Move-IcingaAgentDefaultConfig;
|
||||||
Set-IcingaAgentNodeName -Hostname $Hostname;
|
Set-IcingaAgentNodeName -Hostname $Hostname;
|
||||||
|
|
@ -172,7 +175,10 @@ function Start-IcingaForWindowsInstallation()
|
||||||
Install-IcingaAgentBaseFeatures;
|
Install-IcingaAgentBaseFeatures;
|
||||||
Write-IcingaAgentApiConfig -Port $IcingaPort;
|
Write-IcingaAgentApiConfig -Port $IcingaPort;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Only continue this, if our installation was successful
|
||||||
|
if ((Get-IcingaAgentInstallation).Installed) {
|
||||||
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaPort -CACert $CertificateCAFile -Ticket $CertificateTicket) -eq $FALSE) {
|
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaPort -CACert $CertificateCAFile -Ticket $CertificateTicket) -eq $FALSE) {
|
||||||
Disable-IcingaAgentFeature 'api';
|
Disable-IcingaAgentFeature 'api';
|
||||||
Write-IcingaConsoleWarning `
|
Write-IcingaConsoleWarning `
|
||||||
|
|
@ -187,6 +193,7 @@ function Start-IcingaForWindowsInstallation()
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-IcingaAgentZonesConfig -Endpoints $IcingaEndpoints -EndpointConnections $IcingaParentAddresses -ParentZone $IcingaZone -GlobalZones $GlobalZones -Hostname $Hostname;
|
Write-IcingaAgentZonesConfig -Endpoints $IcingaEndpoints -EndpointConnections $IcingaParentAddresses -ParentZone $IcingaZone -GlobalZones $GlobalZones -Hostname $Hostname;
|
||||||
|
}
|
||||||
|
|
||||||
if ($InstallService) {
|
if ($InstallService) {
|
||||||
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.IcingaForWindowsService' -Value $WindowsServiceDir;
|
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.IcingaForWindowsService' -Value $WindowsServiceDir;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue