Fix wrong plugin not installed unknown checkresult

This commit is contained in:
Lord Hepipud 2021-03-01 12:02:39 +01:00
parent ed43260bec
commit e7c341e30a
3 changed files with 10 additions and 4 deletions

View file

@ -34,6 +34,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#208](https://github.com/Icinga/icinga-powershell-framework/pull/208) Fixes `Convert-IcingaPluginThresholds` which sometimes did not return proper numeric usable values for our internal functions, causing issues on plugin calls. In addition the function now also supports the handling for % units. * [#208](https://github.com/Icinga/icinga-powershell-framework/pull/208) Fixes `Convert-IcingaPluginThresholds` which sometimes did not return proper numeric usable values for our internal functions, causing issues on plugin calls. In addition the function now also supports the handling for % units.
* [#213](https://github.com/Icinga/icinga-powershell-framework/pull/213) Fixed possible crash on `Get-IcingaAgentFeatures` if PowerShell is not running as administrator and therefor the command `icinga2 feature list` can not be processed * [#213](https://github.com/Icinga/icinga-powershell-framework/pull/213) Fixed possible crash on `Get-IcingaAgentFeatures` if PowerShell is not running as administrator and therefor the command `icinga2 feature list` can not be processed
* [#213](https://github.com/Icinga/icinga-powershell-framework/pull/213) Fixed `ConvertTo-IcingaSecureString` to return `$null` for empty strings instead of throwing an exception * [#213](https://github.com/Icinga/icinga-powershell-framework/pull/213) Fixed `ConvertTo-IcingaSecureString` to return `$null` for empty strings instead of throwing an exception
* [#214](https://github.com/Icinga/icinga-powershell-framework/pull/214) Fixes wrong `[Unknown] PluginNotInstalled` exception because of new plugin configuration and wrong checking against APi result in case feature is enabled
### Experimental ### Experimental

View file

@ -101,7 +101,12 @@ function Invoke-IcingaInternalServiceCall()
$IcingaCR = ''; $IcingaCR = '';
# In case we didn't receive a check result, fallback to local execution # In case we didn't receive a check result, fallback to local execution
if ($null -eq $IcingaResult.$Command.checkresult) { if ([string]::IsNullOrEmpty($IcingaResult.$Command.checkresult)) {
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $DebugArguments;
return;
}
if ([string]::IsNullOrEmpty($IcingaResult.$Command.exitcode)) {
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $DebugArguments; Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $DebugArguments;
return; return;
} }

View file

@ -4,8 +4,6 @@ function Exit-IcingaExecutePlugin()
[string]$Command = '' [string]$Command = ''
); );
Exit-IcingaPluginNotInstalled -Command $Command;
Invoke-IcingaInternalServiceCall -Command $Command -Arguments $args; Invoke-IcingaInternalServiceCall -Command $Command -Arguments $args;
try { try {
@ -14,6 +12,8 @@ function Exit-IcingaExecutePlugin()
Use-Icinga; Use-Icinga;
} }
Exit-IcingaPluginNotInstalled -Command $Command;
exit (& $Command @args); exit (& $Command @args);
} catch { } catch {
$ExMsg = $_.Exception.Message; $ExMsg = $_.Exception.Message;