From 7dfa22774f36184bcf9d84e729f101b32e07755f Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Sat, 7 Aug 2021 14:30:01 +0200 Subject: [PATCH] Adds rebuild cache switch to icinga cmd --- doc/31-Changelog.md | 1 + icinga-powershell-framework.psm1 | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index e0c78d6..ab306da 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -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) diff --git a/icinga-powershell-framework.psm1 b/icinga-powershell-framework.psm1 index 16ebf6d..e4410b7 100644 --- a/icinga-powershell-framework.psm1 +++ b/icinga-powershell-framework.psm1 @@ -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];