Remove experimental for API Checks and module note

This commit is contained in:
Lord Hepipud 2022-01-14 20:53:16 +01:00
parent bf8d6479a9
commit dd2d71ee07
10 changed files with 44 additions and 26 deletions

View file

@ -23,6 +23,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#411](https://github.com/Icinga/icinga-powershell-framework/pull/411) Fixes Icinga Director error message output because of missing `[string]::Format()` * [#411](https://github.com/Icinga/icinga-powershell-framework/pull/411) Fixes Icinga Director error message output because of missing `[string]::Format()`
* [#412](https://github.com/Icinga/icinga-powershell-framework/issues/412) Fixes possible defective state of the Icinga Agent by using a custom service user for JEA profiles which is larger than 20 digits * [#412](https://github.com/Icinga/icinga-powershell-framework/issues/412) Fixes possible defective state of the Icinga Agent by using a custom service user for JEA profiles which is larger than 20 digits
* [#418](https://github.com/Icinga/icinga-powershell-framework/pull/418) Fixes crash on wrong variable usage introduced by [#411](https://github.com/Icinga/icinga-powershell-framework/pull/411) * [#418](https://github.com/Icinga/icinga-powershell-framework/pull/418) Fixes crash on wrong variable usage introduced by [#411](https://github.com/Icinga/icinga-powershell-framework/pull/411)
* [#421](https://github.com/Icinga/icinga-powershell-framework/issues/421) Fixes experimental state of `API Check` feature by removing that term and removing the requirement to install `icinga-powershell-restapi` and `icinga-powershell-apichecks`
### Enhancements ### Enhancements

View file

@ -15,5 +15,5 @@
function Disable-IcingaFrameworkApiChecks() function Disable-IcingaFrameworkApiChecks()
{ {
Set-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks' -Value $FALSE; Set-IcingaPowerShellConfig -Path 'Framework.ApiChecks' -Value $FALSE;
} }

View file

@ -15,7 +15,5 @@
function Enable-IcingaFrameworkApiChecks() function Enable-IcingaFrameworkApiChecks()
{ {
Set-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks' -Value $TRUE; Set-IcingaPowerShellConfig -Path 'Framework.ApiChecks' -Value $TRUE;
Write-IcingaConsoleNotice 'Please ensure to install the components "icinga-powershell-restapi" and "icinga-powershell-apichecks", install the Icinga for Windows Service and also register the daemon with "Register-IcingaBackgroundDaemon -Command {0}". Afterwards all checks will be executed by the background daemon in case it is running. Further details can be found at https://icinga.com/docs/icinga-for-windows/latest/doc/110-Installation/30-API-Check-Forwarder/' -Objects "'Start-IcingaWindowsRESTApi'";
} }

View file

@ -18,11 +18,11 @@
function Get-IcingaFrameworkApiChecks() function Get-IcingaFrameworkApiChecks()
{ {
$CodeCaching = Get-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks'; $ApiChecks = Get-IcingaPowerShellConfig -Path 'Framework.ApiChecks';
if ($null -eq $CodeCaching) { if ($null -eq $ApiChecks) {
return $FALSE; return $FALSE;
} }
return $CodeCaching; return $ApiChecks;
} }

View file

@ -101,6 +101,11 @@ function Install-IcingaFrameworkUpdate()
Write-IcingaFrameworkCodeCache; Write-IcingaFrameworkCodeCache;
} }
Import-Module -Name $ModuleDirectory -Force;
# Apply migration tasks
Invoke-IcingaForWindowsMigration;
if ([string]::IsNullOrEmpty((Get-IcingaJEAContext)) -eq $FALSE) { if ([string]::IsNullOrEmpty((Get-IcingaJEAContext)) -eq $FALSE) {
Remove-IcingaFrameworkDependencyFile; Remove-IcingaFrameworkDependencyFile;
Write-IcingaConsoleNotice 'Updating Icinga JEA profile'; Write-IcingaConsoleNotice 'Updating Icinga JEA profile';

View file

@ -0,0 +1,14 @@
function Invoke-IcingaForWindowsMigration()
{
# Upgrade to v1.8.0
if ((Get-Module -ListAvailable -Name icinga-powershell-framework).Version -ge (New-IcingaVersionObject -Version '1.8.0')) {
Write-IcingaConsoleNotice 'Applying pending migrations required for Icinga for Windows v1.8.0';
$ApiChecks = Get-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks';
if ($null -ne $ApiChecks) {
Remove-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks' | Out-Null;
Set-IcingaPowerShellConfig -Path 'Framework.ApiChecks' -Value $ApiChecks;
}
}
}

View file

@ -29,11 +29,6 @@ function Invoke-IcingaInternalServiceCall()
return; return;
} }
# If neither 'icinga-powershell-restapi' or 'icinga-powershell-apichecks' is installed, execute the plugin locally
if ((Test-IcingaFunction 'Invoke-IcingaApiChecksRESTCall') -eq $FALSE -Or (Test-IcingaFunction 'Start-IcingaWindowsRESTApi') -eq $FALSE) {
return;
}
$RestApiPort = 5668; $RestApiPort = 5668;
[int]$Timeout = 30; [int]$Timeout = 30;
$Daemon = $BackgroundDaemons['Start-IcingaWindowsRESTApi']; $Daemon = $BackgroundDaemons['Start-IcingaWindowsRESTApi'];

View file

@ -4,16 +4,5 @@ function Show-IcingaForWindowsManagementConsoleFrameworkExperimental()
Show-IcingaForWindowsInstallerMenu ` Show-IcingaForWindowsInstallerMenu `
-Header 'Manage Icinga for Windows experimental features. Not recommended for production!' ` -Header 'Manage Icinga for Windows experimental features. Not recommended for production!' `
-Entries @( -Entries @();
@{
'Caption' = ([string]::Format('Forward checks to Api: {0}', (& { if ($ApiChecks) { 'Enabled' } else { 'Disabled' } } )));
'Command' = 'Show-IcingaForWindowsManagementConsoleFrameworkExperimental';
'Help' = 'In case enabled, all check commands executed by "Exit-IcingaExecutePlugin" are forwarded to an internal REST-Api and executed from within the Icinga for Windows background daemon. Requires the Icinga for Windows background daemon and the modules "icinga-powershell-restapi" and "icinga-powershell-apichecks"';
'Disabled' = $FALSE;
'Action' = @{
'Command' = 'Invoke-IcingaForWindowsMangementConsoleToogleFrameworkApiChecks';
'Arguments' = @{ };
}
}
);
} }

View file

@ -1,6 +1,7 @@
function Show-IcingaForWindowsManagementConsoleManageFramework() function Show-IcingaForWindowsManagementConsoleManageFramework()
{ {
$FrameworkDebug = Get-IcingaFrameworkDebugMode; $FrameworkDebug = Get-IcingaFrameworkDebugMode;
$ApiChecks = Get-IcingaFrameworkApiChecks;
$IcingaService = Get-Service 'icingapowershell' -ErrorAction SilentlyContinue; $IcingaService = Get-Service 'icingapowershell' -ErrorAction SilentlyContinue;
$AdminShell = $global:Icinga.InstallWizard.AdminShell; $AdminShell = $global:Icinga.InstallWizard.AdminShell;
$ServiceStatus = $null; $ServiceStatus = $null;
@ -36,6 +37,16 @@ function Show-IcingaForWindowsManagementConsoleManageFramework()
'Disabled' = $JEADisabled; 'Disabled' = $JEADisabled;
'DisabledReason' = ([string]::Format('PowerShell version "{0}" is lower than 5.0 or you are not inside an administrative shell', $PSVersionTable.PSVersion.ToString(2))); 'DisabledReason' = ([string]::Format('PowerShell version "{0}" is lower than 5.0 or you are not inside an administrative shell', $PSVersionTable.PSVersion.ToString(2)));
}, },
@{
'Caption' = ([string]::Format('Forward checks to Api: {0}', (& { if ($ApiChecks) { 'Enabled' } else { 'Disabled' } } )));
'Command' = 'Show-IcingaForWindowsManagementConsoleManageFramework';
'Help' = 'In case enabled, all check commands executed by "Exit-IcingaExecutePlugin" are forwarded to an internal REST-Api and executed from within the Icinga for Windows background daemon. Requires the Icinga for Windows background daemon';
'Disabled' = $FALSE;
'Action' = @{
'Command' = 'Invoke-IcingaForWindowsMangementConsoleToogleFrameworkApiChecks';
'Arguments' = @{ };
}
},
@{ @{
'Caption' = ([string]::Format('Framework Debug Mode: {0}', (& { if ($FrameworkDebug) { 'Enabled' } else { 'Disabled' } } ))); 'Caption' = ([string]::Format('Framework Debug Mode: {0}', (& { if ($FrameworkDebug) { 'Enabled' } else { 'Disabled' } } )));
'Command' = 'Show-IcingaForWindowsManagementConsoleManageFramework'; 'Command' = 'Show-IcingaForWindowsManagementConsoleManageFramework';

View file

@ -187,6 +187,11 @@ function Install-IcingaComponent()
Write-IcingaFrameworkCodeCache; Write-IcingaFrameworkCodeCache;
} }
Import-Module -Name $ComponentFolder -Force;
# Apply migration tasks
Invoke-IcingaForWindowsMigration;
if ($ServiceStatus -eq 'Running') { if ($ServiceStatus -eq 'Running') {
Write-IcingaConsoleNotice 'Starting Icinga for Windows service'; Write-IcingaConsoleNotice 'Starting Icinga for Windows service';
Start-IcingaService 'icingapowershell'; Start-IcingaService 'icingapowershell';
@ -195,9 +200,9 @@ function Install-IcingaComponent()
Write-IcingaConsoleNotice 'Starting Icinga Agent service'; Write-IcingaConsoleNotice 'Starting Icinga Agent service';
Start-IcingaService 'icinga2'; Start-IcingaService 'icinga2';
} }
} } else {
Import-Module -Name $ComponentFolder -Force; Import-Module -Name $ComponentFolder -Force;
}
# This will ensure that Framework functions will always win over third party functions, overwriting functionality # This will ensure that Framework functions will always win over third party functions, overwriting functionality
# of the Framework, which might cause problems during installation otherwise # of the Framework, which might cause problems during installation otherwise