Skip to content

Commit

Permalink
Merge pull request #323 from Icinga:feature/add_rebuild_cache_to_icinga
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LordHepipud authored Aug 7, 2021
2 parents 5f86b2d + 7dfa227 commit 76c4aac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/31-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 8 additions & 3 deletions icinga-powershell-framework.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand All @@ -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];
Expand Down

0 comments on commit 76c4aac

Please sign in to comment.