Fixes wrong variable used for API check request

This commit is contained in:
Lord Hepipud 2021-03-01 12:37:15 +01:00
parent 2ae5aff7cf
commit 33aca914b4
2 changed files with 5 additions and 6 deletions

View file

@ -35,6 +35,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#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
* [#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
* [#215](https://github.com/Icinga/icinga-powershell-framework/pull/215) Fixes wrong used variable for arguments on API call checks
### Experimental

View file

@ -53,8 +53,6 @@ function Invoke-IcingaInternalServiceCall()
Enable-IcingaUntrustedCertificateValidation -SuppressMessages;
[hashtable]$CommandArguments = @{ };
[hashtable]$DebugArguments = @{ };
[hashtable]$ConvertedArgs = @{ };
[int]$ArgumentIndex = 0;
# Resolve our array arguments provided by $args and build proper check arguments
@ -81,7 +79,7 @@ function Invoke-IcingaInternalServiceCall()
$Argument = $Argument.Replace('-', '');
$ConvertedArgs.Add($Argument, $ArgumentValue);
$CommandArguments.Add($Argument, $ArgumentValue);
$ArgumentIndex += 1;
}
@ -92,7 +90,7 @@ function Invoke-IcingaInternalServiceCall()
# Something went wrong -> fallback to local execution
$ExMsg = $_.Exception.message;
# Fallback to execute plugin locally
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects $ExMsg, $Command, $DebugArguments;
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects $ExMsg, $Command, $CommandArguments;
return;
}
@ -102,12 +100,12 @@ function Invoke-IcingaInternalServiceCall()
# In case we didn't receive a check result, fallback to local execution
if ([string]::IsNullOrEmpty($IcingaResult.$Command.checkresult)) {
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, $CommandArguments;
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, $CommandArguments;
return;
}