mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fix module import on non PS folders
This commit is contained in:
parent
aa764061da
commit
e3c9396c59
9 changed files with 22412 additions and 19 deletions
22410
cache/framework_cache.psm1
vendored
22410
cache/framework_cache.psm1
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,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`
|
||||
|
||||
### Enhancements
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function Use-Icinga()
|
|||
);
|
||||
|
||||
if ($null -ne $Global:Icinga -And $Global:Icinga.ContainsKey('RebuildCache') -And $Global:Icinga.RebuildCache) {
|
||||
Import-Module 'icinga-powershell-framework' -Global -Force;
|
||||
Import-Module (Join-Path -Path (Get-IcingaForWindowsRootPath) -ChildPath 'icinga-powershell-framework') -Global -Force;
|
||||
}
|
||||
|
||||
Disable-IcingaProgressPreference;
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ function Install-IcingaFrameworkComponent()
|
|||
Use-Icinga;
|
||||
|
||||
# Unload the module if it was loaded before
|
||||
Remove-Module $RepositoryName -Force -ErrorAction SilentlyContinue;
|
||||
Remove-Module $PluginDirectory -Force -ErrorAction SilentlyContinue;
|
||||
# Now import the module
|
||||
Import-Module $RepositoryName;
|
||||
Import-Module $PluginDirectory;
|
||||
|
||||
Write-IcingaConsoleNotice ([string]::Format('Icinga {0} update has been completed. Please start a new PowerShell to apply it', $ComponentName));
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ function Invoke-IcingaNamespaceCmdlets()
|
|||
|
||||
foreach ($Cmdlet in $CommandList) {
|
||||
try {
|
||||
$CmmandName = $Cmdlet.Name;
|
||||
$CommandName = $Cmdlet.Name;
|
||||
Import-Module $Cmdlet.Module.Path -WarningAction SilentlyContinue -ErrorAction Stop;
|
||||
|
||||
$Content = (& $CmmandName);
|
||||
$Content = (& $CommandName);
|
||||
Add-IcingaHashtableItem `
|
||||
-Hashtable $CommandConfig `
|
||||
-Key $Cmdlet.Name `
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ function Install-IcingaComponent()
|
|||
}
|
||||
}
|
||||
|
||||
Import-Module -Name $PackageName -Force;
|
||||
Import-Module -Name $ComponentFolder -Force;
|
||||
Write-IcingaConsoleNotice 'Installation of component "{0}" with version "{1}" was successful. Open a new PowerShell to apply the changes' -Objects $Name.ToLower(), $ManifestFile.ModuleVersion;
|
||||
} else {
|
||||
<#
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ function New-IcingaCheckCommand()
|
|||
Import-Module $ScriptFile -Global;
|
||||
|
||||
if ([string]::IsNullOrEmpty($DefaultEditor) -eq $FALSE -And ($null -eq (Get-Command $DefaultEditor -ErrorAction SilentlyContinue)) -And ((Test-Path $DefaultEditor) -eq $FALSE)) {
|
||||
Write-IcingaConsoleWarning 'No default editor for .psm1 files found. Specify a default editor to automaticly open the newly generated check plugin.';
|
||||
Write-IcingaConsoleWarning 'No default editor for .psm1 files found. Specify a default editor to automatically open the newly generated check plugin.';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function Exit-IcingaPluginNotInstalled()
|
|||
ForEach-Object {
|
||||
foreach ($cmd in $_.ExportedCommands.Values) {
|
||||
if ($Command.ToLower() -eq $cmd.Name.ToLower()) {
|
||||
return $cmd.Source;
|
||||
return $cmd.Path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue