Merge pull request #708 from Icinga:fix/framework_update_order

Fix: Update order for components to always update the framework first

Fixes the order for updating components with `Update-Icinga`, to ensure the `framework` is always updated first before all other components
This commit is contained in:
Lord Hepipud 2024-04-09 18:01:13 +02:00 committed by GitHub
commit 9a2090455c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 2 deletions

View file

@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#672](https://github.com/Icinga/icinga-powershell-framework/pull/issues) Fixes Icinga for Windows REST-Api to fully read client data, even when they client is sending the packets on a very slow basis, preventing the API trying to process an incomplete request
* [#707](https://github.com/Icinga/icinga-powershell-framework/pull/707) Fixes size of the `Icinga for Windows` eventlog by setting it to `20MiB`, allowing to store more events before they are overwritten
* [#708](https://github.com/Icinga/icinga-powershell-framework/pull/708) Fixes the order for updating components with `Update-Icinga`, to ensure the `framework` is always updated first before all other components
* [#710](https://github.com/Icinga/icinga-powershell-framework/pull/710) Fixes various console errors while running Icinga for Windows outside of an administrative shell
* [#713](https://github.com/Icinga/icinga-powershell-framework/pull/713) Fixes Icinga for Windows REST-Api which fails during certificate auth handling while running as `NT Authority\NetworkService`
* [#714](https://github.com/Icinga/icinga-powershell-framework/pull/714) Fixes missing service environment information during initial setup of Icinga for Windows v1.12 on some systems

View file

@ -13,10 +13,31 @@ function Update-Icinga()
$Release = $TRUE;
}
$CurrentInstallation = Get-IcingaInstallation -Release:$Release -Snapshot:$Snapshot;
[bool]$UpdateJEA = $FALSE;
$CurrentInstallation = Get-IcingaInstallation -Release:$Release -Snapshot:$Snapshot;
[bool]$UpdateJEA = $FALSE;
[array]$ComponentsList = @();
# We need to make sure that the framework is always installed first as component
# to prevent possible race-conditions during update, in case we update plugins
# before the framework. For plugins this applies as well, as other components
# could use them as depdency
if ($CurrentInstallation.ContainsKey('framework')) {
$ComponentsList += 'framework';
}
if ($CurrentInstallation.ContainsKey('plugins')) {
$ComponentsList += 'plugins';
}
# Add all other components, but skip the framework in this case
foreach ($entry in $CurrentInstallation.Keys) {
if ($entry -eq 'framework' -Or $entry -eq 'plugins') {
continue;
}
$ComponentsList += $entry;
}
# Now process with your installation
foreach ($entry in $ComponentsList) {
$Component = $CurrentInstallation[$entry];
if ([string]::IsNullOrEmpty($Name) -eq $FALSE -And $Name -ne $entry) {