Merge pull request #323 from Icinga:feature/add_rebuild_cache_to_icinga

Feature: Adds rebuild cache switch to icinga cmd

As we move forward with enforcing the Framework Code Cache, we should make it easier for developers to rebuild the cache while testing new features.

For this we now added the `RebuildCache` switch for `icinga` alias and `Invoke-IcingaCommand` which rebuilds the cache before the actual Icinga Shell or Icinga Command is executed.
This commit is contained in:
Lord Hepipud 2021-08-07 14:39:22 +02:00 committed by GitHub
commit 76c4aac7a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -25,6 +25,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#316](https://github.com/Icinga/icinga-powershell-framework/pull/316) The reconfigure menu was previously present inside the Icinga Agent sub-menu and is now moved to the main installation menu for the Management Console
* [#318](https://github.com/Icinga/icinga-powershell-framework/pull/318) We always enforce the Icinga Framework Code caching now and ship a plain file to build the cache on first loading
* [#322](https://github.com/Icinga/icinga-powershell-framework/pull/322) Remove legacy import feature from Framework and replace it with a dummy function, as no longer required by Icinga for Windows
* [#323](https://github.com/Icinga/icinga-powershell-framework/pull/323) Adds `-RebuildCache` switch to `icinga` command alias and `Invoke-IcingaCommand`, for quicker cache re-creation for developers
## 1.5.2 (2021-07-09)

View file

@ -203,9 +203,10 @@ function Invoke-IcingaCommand()
[CmdletBinding()]
param (
$ScriptBlock,
[switch]$SkipHeader = $FALSE,
[switch]$Manage = $FALSE,
[array]$ArgumentList = @()
[switch]$SkipHeader = $FALSE,
[switch]$Manage = $FALSE,
[switch]$RebuildCache = $FALSE,
[array]$ArgumentList = @()
);
Import-LocalizedData `
@ -229,6 +230,10 @@ function Invoke-IcingaCommand()
Write-IcingaConsoleHeader -HeaderLines $Headers;
}
if ($RebuildCache) {
Write-IcingaFrameworkCodeCache;
}
powershell.exe -NoExit -Command {
$Script = $args[0];
$RootPath = $args[1];