Merge pull request #440 from Icinga:feature/add_service_upgrade_notification

Feature: Adds upgrade notification to service binary

Ensures we add an upgrade notification if we are running the Icinga for Windows Service binary older than v1.2.0, which will not work with Icinga for Windows v1.8.0 or later.
This commit is contained in:
Lord Hepipud 2022-01-25 11:55:23 +01:00 committed by GitHub
commit db4d86e5b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -35,6 +35,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#417](https://github.com/Icinga/icinga-powershell-framework/issues/417) Adds support to allow the force creation of Icinga Agent certificates, even when they are already present on the system over Icinga Management Console installation * [#417](https://github.com/Icinga/icinga-powershell-framework/issues/417) Adds support to allow the force creation of Icinga Agent certificates, even when they are already present on the system over Icinga Management Console installation
* [#427](https://github.com/Icinga/icinga-powershell-framework/issues/427) Moves Icinga for Windows EventLog from `Application` to a custom log `Icinga for Windows`, allowing better separation * [#427](https://github.com/Icinga/icinga-powershell-framework/issues/427) Moves Icinga for Windows EventLog from `Application` to a custom log `Icinga for Windows`, allowing better separation
* [#438](https://github.com/Icinga/icinga-powershell-framework/pull/438) Adds support for enabling the REST-Api background daemon and the Api-Check feature during the IMC installation wizard on advanced settings, which will be enabled by default * [#438](https://github.com/Icinga/icinga-powershell-framework/pull/438) Adds support for enabling the REST-Api background daemon and the Api-Check feature during the IMC installation wizard on advanced settings, which will be enabled by default
* [#440](https://github.com/Icinga/icinga-powershell-framework/pull/440) Adds upgrade notification if Icinga for Windows Service binary older than v1.2.0 is used, which will not work with Icinga for Windows v1.8.0 or later
## 1.7.1 (2021-11-11) ## 1.7.1 (2021-11-11)

View file

@ -1,5 +1,16 @@
function Invoke-IcingaForWindowsMigration() function Invoke-IcingaForWindowsMigration()
{ {
$IcingaForWindowsService = Get-IcingaForWindowsServiceData;
if (([string]::IsNullOrEmpty($IcingaForWindowsService.FullPath) -eq $FALSE -And (Test-Path $IcingaForWindowsService.FullPath))) {
$ServiceBinaryData = Read-IcingaServicePackage -File $IcingaForWindowsService.FullPath;
if ($ServiceBinaryData.FileVersion -lt (New-IcingaVersionObject -Version '1.2.0')) {
Write-IcingaConsoleWarning -Message 'You are running a Icinga for Windows Service binary older than v1.2.0. You need to upgrade to v1.2.0 or later before you can use Icinga for Windows properly. You can update it with "Update-Icinga -Name service"';
return;
}
}
# Upgrade to v1.8.0 # Upgrade to v1.8.0
if (Test-IcingaForWindowsMigration -MigrationVersion (New-IcingaVersionObject -Version '1.8.0')) { if (Test-IcingaForWindowsMigration -MigrationVersion (New-IcingaVersionObject -Version '1.8.0')) {
$ServiceStatus = (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue).Status; $ServiceStatus = (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue).Status;