mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Merge pull request #590 from Icinga:fix/background_service_registration_not_working
Fix: Background service registration Fixes background service registration caused by migration task for v1.10.0 being executed even when no services were defined before
This commit is contained in:
commit
9f91290e23
2 changed files with 32 additions and 11 deletions
|
|
@ -7,6 +7,14 @@ documentation before upgrading to a new release.
|
|||
|
||||
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed).
|
||||
|
||||
## 1.10.1 (2022-27-10)
|
||||
|
||||
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/27?closed=1)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* [#582](https://github.com/Icinga/icinga-powershell-framework/issues/582) Fixes background service registration caused by migration task for v1.10.0 being executed even when no services were defined before
|
||||
|
||||
## 1.10.0 (2022-08-30)
|
||||
|
||||
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/23?closed=1)
|
||||
|
|
|
|||
|
|
@ -52,28 +52,41 @@ function Invoke-IcingaForWindowsMigration()
|
|||
# Convert the time intervals for the background daemon services from the previous index handling
|
||||
# 1, 3, 5, 15 as example to 1m, 3m, 5m, 15m
|
||||
$BackgroundServices = Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices';
|
||||
[hashtable]$Output = @{ };
|
||||
|
||||
foreach ($service in $BackgroundServices.PSObject.Properties) {
|
||||
[array]$ConvertedTimeIndex = @();
|
||||
# Only run this migration in case background services are defined
|
||||
if ($null -ne $BackgroundServices) {
|
||||
foreach ($service in $BackgroundServices.PSObject.Properties) {
|
||||
[array]$ConvertedTimeIndex = @();
|
||||
|
||||
foreach ($interval in $service.Value.TimeIndexes) {
|
||||
if (Test-Numeric $interval) {
|
||||
$ConvertedTimeIndex += [string]::Format('{0}m', $interval);
|
||||
} else {
|
||||
$ConvertedTimeIndex = $interval;
|
||||
foreach ($interval in $service.Value.TimeIndexes) {
|
||||
if (Test-Numeric $interval) {
|
||||
$ConvertedTimeIndex += [string]::Format('{0}m', $interval);
|
||||
} else {
|
||||
$ConvertedTimeIndex = $interval;
|
||||
}
|
||||
}
|
||||
|
||||
$service.Value.TimeIndexes = $ConvertedTimeIndex;
|
||||
}
|
||||
|
||||
$service.Value.TimeIndexes = $ConvertedTimeIndex;
|
||||
Set-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices' -Value $BackgroundServices;
|
||||
}
|
||||
|
||||
Set-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices' -Value $BackgroundServices;
|
||||
|
||||
Set-IcingaForWindowsMigration -MigrationVersion (New-IcingaVersionObject -Version '1.10.0');
|
||||
|
||||
if ($ServiceStatus -eq 'Running') {
|
||||
Restart-IcingaWindowsService -Service 'icingapowershell';
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-IcingaForWindowsMigration -MigrationVersion (New-IcingaVersionObject -Version '1.10.1')) {
|
||||
Write-IcingaConsoleNotice 'Applying pending migrations required for Icinga for Windows v1.10.1';
|
||||
|
||||
# Fix Icinga for Windows v1.10.0 broken background service registration
|
||||
if ($null -eq (Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices')) {
|
||||
Remove-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices';
|
||||
}
|
||||
|
||||
Set-IcingaForWindowsMigration -MigrationVersion (New-IcingaVersionObject -Version '1.10.1');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue