mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes JEA error on no modules installed and output
This commit is contained in:
parent
9bcd2210e7
commit
210862e683
3 changed files with 16 additions and 3 deletions
|
|
@ -32,6 +32,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#441](https://github.com/Icinga/icinga-powershell-framework/pull/441) Fixes an exception while loading the Framework, caused by a race condition for missing environment variables which are accessed by some plugins before the Framework is loaded properly
|
* [#441](https://github.com/Icinga/icinga-powershell-framework/pull/441) Fixes an exception while loading the Framework, caused by a race condition for missing environment variables which are accessed by some plugins before the Framework is loaded properly
|
||||||
* [#446](https://github.com/Icinga/icinga-powershell-framework/pull/446) Fixes Icinga for Windows progress preference, which sometimes caused UI glitches
|
* [#446](https://github.com/Icinga/icinga-powershell-framework/pull/446) Fixes Icinga for Windows progress preference, which sometimes caused UI glitches
|
||||||
* [#449](https://github.com/Icinga/icinga-powershell-framework/pull/449) Fixes unhandled exception while importing modules during `Install-IcingaComponent` process, because of possible missing dependencies
|
* [#449](https://github.com/Icinga/icinga-powershell-framework/pull/449) Fixes unhandled exception while importing modules during `Install-IcingaComponent` process, because of possible missing dependencies
|
||||||
|
* [#451](https://github.com/Icinga/icinga-powershell-framework/pull/451) Fixes PowerShell being unable to enter JEA context if only the Framework is installed and removes the `|` from plugin output, in case a JEA error is thrown that check commands are not present
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,13 @@ function Get-IcingaJEAConfiguration()
|
||||||
-CmdName 'Add-IcingaForWindowsDaemon' `
|
-CmdName 'Add-IcingaForWindowsDaemon' `
|
||||||
-CmdType 'Function';
|
-CmdType 'Function';
|
||||||
|
|
||||||
|
# Fixes error if only the Icinga PowerShell Framework is installed, which then causes JEA to fail entirely because of this missing Cmdlet
|
||||||
|
$UsedCmdlets = Get-IcingaCommandDependency `
|
||||||
|
-DependencyList $DependencyList `
|
||||||
|
-CompiledList $UsedCmdlets `
|
||||||
|
-CmdName 'Select-Object' `
|
||||||
|
-CmdType 'Cmdlet';
|
||||||
|
|
||||||
# Finally loop through all commands again and build our JEA command list
|
# Finally loop through all commands again and build our JEA command list
|
||||||
$DeserializedFile = Read-IcingaPowerShellModuleFile -FileContent $ModuleContent;
|
$DeserializedFile = Read-IcingaPowerShellModuleFile -FileContent $ModuleContent;
|
||||||
[array]$JeaCmds = $DeserializedFile.CommandList + $DeserializedFile.FunctionList;
|
[array]$JeaCmds = $DeserializedFile.CommandList + $DeserializedFile.FunctionList;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,15 @@ function Write-IcingaPluginResult()
|
||||||
|
|
||||||
[string]$CheckResult = $PluginOutput;
|
[string]$CheckResult = $PluginOutput;
|
||||||
|
|
||||||
if ($PluginPerfData -ne 0) {
|
if ($PluginPerfData.Count -ne 0) {
|
||||||
$CheckResult += "`n`r| ";
|
[string]$PerfDataContent = '';
|
||||||
foreach ($PerfData in $PluginPerfData) {
|
foreach ($PerfData in $PluginPerfData) {
|
||||||
$CheckResult += $PerfData;
|
$PerfDataContent += $PerfData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($PerfDataContent) -eq $FALSE) {
|
||||||
|
$CheckResult += "`n`r| ";
|
||||||
|
$CheckResult += $PerfDataContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue