mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Fixes recursive loop on first loading of Framework
This commit is contained in:
parent
2772c888cc
commit
ada2b4ce0e
4 changed files with 43 additions and 1 deletions
17
cache/framework_cache.psm1
vendored
17
cache/framework_cache.psm1
vendored
|
|
@ -8,6 +8,21 @@
|
|||
Manually enabling the feature is no longer required.
|
||||
#>
|
||||
|
||||
# Ensure we only load this module once
|
||||
if ($null -ne $Global:Icinga -And $Global:Icinga.ContainsKey('CacheBuilding') -And $Global:Icinga['CacheBuilding']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($null -eq $Global:Icinga) {
|
||||
$Global:Icinga = @{ };
|
||||
}
|
||||
|
||||
if ($Global:Icinga.ContainsKey('CacheBuilding') -eq $FALSE) {
|
||||
$Global:Icinga.Add('CacheBuilding', $TRUE);
|
||||
} else {
|
||||
$Global:Icinga.CacheBuilding = $TRUE;
|
||||
}
|
||||
|
||||
# Ensures that VS Code is not generating the cache file
|
||||
if ($null -ne $env:TERM_PROGRAM) {
|
||||
Write-IcingaFrameworkCodeCache -DeveloperMode;
|
||||
|
|
@ -22,3 +37,5 @@ Import-Module icinga-powershell-framework -Force;
|
|||
if ($null -ne $env:TERM_PROGRAM -Or $Global:Icinga.Protected.DeveloperMode) {
|
||||
Copy-IcingaFrameworkCacheTemplate;
|
||||
}
|
||||
|
||||
$Global:Icinga.CacheBuilding = $FALSE;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,11 @@ function Write-IcingaFrameworkCodeCache()
|
|||
|
||||
[System.IO.File]::WriteAllLines($CacheFile, $CacheContent, (New-Object System.Text.UTF8Encoding $TRUE));
|
||||
|
||||
Remove-IcingaFrameworkDependencyFile;
|
||||
$DependencyFile = Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'framework_dependencies.json';
|
||||
|
||||
if ((Test-Path $DependencyFile)) {
|
||||
Remove-Item -Path $DependencyFile -Force | Out-Null;
|
||||
}
|
||||
|
||||
if ($Global:Icinga.Protected.DeveloperMode) {
|
||||
Copy-IcingaFrameworkCacheTemplate;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ function New-IcingaEnvironmentVariable()
|
|||
$Global:Icinga = @{ };
|
||||
}
|
||||
|
||||
if ($Global:Icinga.ContainsKey('CacheBuilding') -eq $FALSE) {
|
||||
$Global:Icinga.Add('CacheBuilding', $FALSE);
|
||||
}
|
||||
|
||||
# Session specific configuration for this shell
|
||||
if ($Global:Icinga.ContainsKey('Private') -eq $FALSE) {
|
||||
$Global:Icinga.Add('Private', @{ });
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@
|
|||
Manually enabling the feature is no longer required.
|
||||
#>
|
||||
|
||||
# Ensure we only load this module once
|
||||
if ($null -ne $Global:Icinga -And $Global:Icinga.ContainsKey('CacheBuilding') -And $Global:Icinga['CacheBuilding']) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($null -eq $Global:Icinga) {
|
||||
$Global:Icinga = @{ };
|
||||
}
|
||||
|
||||
if ($Global:Icinga.ContainsKey('CacheBuilding') -eq $FALSE) {
|
||||
$Global:Icinga.Add('CacheBuilding', $TRUE);
|
||||
} else {
|
||||
$Global:Icinga.CacheBuilding = $TRUE;
|
||||
}
|
||||
|
||||
# Ensures that VS Code is not generating the cache file
|
||||
if ($null -ne $env:TERM_PROGRAM) {
|
||||
Write-IcingaFrameworkCodeCache -DeveloperMode;
|
||||
|
|
@ -22,3 +37,5 @@ Import-Module icinga-powershell-framework -Force;
|
|||
if ($null -ne $env:TERM_PROGRAM -Or $Global:Icinga.Protected.DeveloperMode) {
|
||||
Copy-IcingaFrameworkCacheTemplate;
|
||||
}
|
||||
|
||||
$Global:Icinga.CacheBuilding = $FALSE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue