mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Fixes missing loading for IfW modules
This commit is contained in:
parent
0eb008db0b
commit
28efe62548
2 changed files with 33 additions and 5 deletions
|
|
@ -7,6 +7,14 @@ documentation before upgrading to a new release.
|
||||||
|
|
||||||
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed).
|
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed).
|
||||||
|
|
||||||
|
## 1.9.1 (2022-05-13)
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
|
||||||
|
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/24?closed=1)
|
||||||
|
|
||||||
|
* [#519](https://github.com/Icinga/icinga-powershell-framework/pull/519) Fixes missing loading of Icinga for Windows modules, which is required to ensure an Icinga for Windows environment is providing all commands and variables to a session, allowing other modules to access these information
|
||||||
|
|
||||||
## 1.9.0 (2022-05-03)
|
## 1.9.0 (2022-05-03)
|
||||||
|
|
||||||
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/20?closed=1)
|
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/20?closed=1)
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,8 @@ function Use-Icinga()
|
||||||
$Global:Icinga.Protected.Minimal = $TRUE;
|
$Global:Icinga.Protected.Minimal = $TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure we autoload the Icinga Plugin collection, provided by the external
|
# Ensure we autoload Icinga for Windows modules into this session
|
||||||
# module 'icinga-powershell-plugins'
|
Import-IcingaForWindowsModulesInSession;
|
||||||
if (Get-Command 'Use-IcingaPlugins' -ErrorAction SilentlyContinue) {
|
|
||||||
Use-IcingaPlugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($Daemon) {
|
if ($Daemon) {
|
||||||
$Global:Icinga.Protected.RunAsDaemon = $TRUE;
|
$Global:Icinga.Protected.RunAsDaemon = $TRUE;
|
||||||
|
|
@ -64,6 +61,29 @@ function Use-Icinga()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Import-IcingaForWindowsModulesInSession()
|
||||||
|
{
|
||||||
|
$CommandList = Get-Command 'Import-IcingaPowerShellComponent*';
|
||||||
|
|
||||||
|
foreach ($entry in $CommandList) {
|
||||||
|
$ModuleName = $entry.Module.Name;
|
||||||
|
$ModulePath = $entry.Module.Path;
|
||||||
|
$RootPath = $ModulePath.Substring(0, $ModulePath.IndexOf($ModuleName));
|
||||||
|
$Command = $entry.Name;
|
||||||
|
|
||||||
|
if ($RootPath.ToLower() -ne (Get-IcingaForWindowsRootPath).ToLower()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($Command) -Or (Test-IcingaFunction $Command) -eq $FALSE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the command if the module is located at the same location as our Framework
|
||||||
|
& $Command | Out-Null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Get-IcingaFrameworkCodeCacheFile()
|
function Get-IcingaFrameworkCodeCacheFile()
|
||||||
{
|
{
|
||||||
return (Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'framework_cache.psm1');
|
return (Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'framework_cache.psm1');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue