Add function to fetch module root path

This commit is contained in:
Lord Hepipud 2019-11-02 12:12:26 +01:00
parent abfbac1448
commit 01b4ca1937
2 changed files with 9 additions and 1 deletions

View file

@ -25,7 +25,7 @@ Description = 'Icinga 2 Windows Agent Module, which allows to entirely monitor t
PowerShellVersion = '3.0'
# Aus diesem Modul zu exportierende Funktionen. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Funktionen vorhanden sind.
FunctionsToExport = @( 'Use-Icinga', 'Import-IcingaLib', 'Publish-IcingaModuleManifests', 'Get-IcingaPluginDir', 'Get-IcingaCustomPluginDir', 'Get-IcingaCacheDir', 'Get-IcingaPowerShellConfigDir', 'Get-IcingaPowerShellModuleFile' )
FunctionsToExport = @( 'Use-Icinga', 'Import-IcingaLib', 'Publish-IcingaModuleManifests', 'Get-IcingaPluginDir', 'Get-IcingaCustomPluginDir', 'Get-IcingaCacheDir', 'Get-IcingaPowerShellConfigDir', 'Get-IcingaFrameworkRootPath', 'Get-IcingaPowerShellModuleFile' )
# Aus diesem Modul zu exportierende Cmdlets. Um optimale Leistung zu erzielen, verwenden Sie keine Plat'zhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Cmdlets vorhanden sind.
CmdletsToExport = @()

View file

@ -173,6 +173,14 @@ function Get-IcingaPowerShellConfigDir()
return (Join-Path -Path $PSScriptRoot -ChildPath 'config');
}
function Get-IcingaFrameworkRootPath()
{
[string]$Path = $PSScriptRoot;
[int]$Index = $Path.LastIndexOf('\') + 1;
$Path = $Path.Substring(0, $Index);
return $Path;
}
function Get-IcingaPowerShellModuleFile()
{
return (Join-Path -Path $PSScriptRoot -ChildPath 'icinga-powershell-framework.psm1');