mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #327 from Icinga:fix/initial_import_exception
Fix: Possible exception on first import run On certain systems you can run into an exception on the first run of the system, as the module is imported but the cache is written on this import run. Therefor a second import run is required, to import the newly generated files.
This commit is contained in:
commit
a52e30190b
2 changed files with 5 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#311](https://github.com/Icinga/icinga-powershell-framework/issues/311) Fixes an issue with negative inputs on some scenarios which will cause an exception for checks instead of continuing executing them properly
|
||||
* [#317](https://github.com/Icinga/icinga-powershell-framework/pull/317) Fixes certain file names being too long, causing errors on deploying branches
|
||||
* [#326](https://github.com/Icinga/icinga-powershell-framework/pull/326) Fixes import for module files, by using the full path to the module now instead of the name only, as files could be placed inside a folder which is not listed inside the `$ENV:PSModulePath`
|
||||
* [#327](https://github.com/Icinga/icinga-powershell-framework/pull/327) Fixes possible exception on first import run for certain systems
|
||||
|
||||
### Enhancements
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ function Use-Icinga()
|
|||
);
|
||||
|
||||
if ($null -ne $Global:Icinga -And $Global:Icinga.ContainsKey('RebuildCache') -And $Global:Icinga.RebuildCache) {
|
||||
# On some systems, this call will re-build the cache
|
||||
Import-Module (Join-Path -Path (Get-IcingaForWindowsRootPath) -ChildPath 'icinga-powershell-framework') -Global -Force;
|
||||
# The second run would then actually import the new module. Only happens on some systems, but with this we fix
|
||||
# possible exceptions
|
||||
Import-Module (Join-Path -Path (Get-IcingaForWindowsRootPath) -ChildPath 'icinga-powershell-framework') -Global -Force;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue