Skip to content

Commit e81b2f6

Browse files
authored
Merge pull request #215 from Icinga:fix/command_argument_parsing_used_wrong_variable
Fix: Wrong variable used for API check request
2 parents 2ae5aff + 33aca91 commit e81b2f6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
3535
* [#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
3636
* [#213](https://github.com/Icinga/icinga-powershell-framework/pull/213) Fixed `ConvertTo-IcingaSecureString` to return `$null` for empty strings instead of throwing an exception
3737
* [#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
38+
* [#215](https://github.com/Icinga/icinga-powershell-framework/pull/215) Fixes wrong used variable for arguments on API call checks
3839

3940
### Experimental
4041

lib/core/framework/Invoke-IcingaInternalServiceCall.psm1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ function Invoke-IcingaInternalServiceCall()
5353
Enable-IcingaUntrustedCertificateValidation -SuppressMessages;
5454

5555
[hashtable]$CommandArguments = @{ };
56-
[hashtable]$DebugArguments = @{ };
57-
[hashtable]$ConvertedArgs = @{ };
5856
[int]$ArgumentIndex = 0;
5957

6058
# Resolve our array arguments provided by $args and build proper check arguments
@@ -81,7 +79,7 @@ function Invoke-IcingaInternalServiceCall()
8179

8280
$Argument = $Argument.Replace('-', '');
8381

84-
$ConvertedArgs.Add($Argument, $ArgumentValue);
82+
$CommandArguments.Add($Argument, $ArgumentValue);
8583
$ArgumentIndex += 1;
8684
}
8785

@@ -92,7 +90,7 @@ function Invoke-IcingaInternalServiceCall()
9290
# Something went wrong -> fallback to local execution
9391
$ExMsg = $_.Exception.message;
9492
# Fallback to execute plugin locally
95-
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects $ExMsg, $Command, $DebugArguments;
93+
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects $ExMsg, $Command, $CommandArguments;
9694
return;
9795
}
9896

@@ -102,12 +100,12 @@ function Invoke-IcingaInternalServiceCall()
102100

103101
# In case we didn't receive a check result, fallback to local execution
104102
if ([string]::IsNullOrEmpty($IcingaResult.$Command.checkresult)) {
105-
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $DebugArguments;
103+
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $CommandArguments;
106104
return;
107105
}
108106

109107
if ([string]::IsNullOrEmpty($IcingaResult.$Command.exitcode)) {
110-
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $DebugArguments;
108+
Write-IcingaEventMessage -Namespace 'Framework' -EventId 1553 -Objects 'The check result for the executed command was empty', $Command, $CommandArguments;
111109
return;
112110
}
113111

0 commit comments

Comments
 (0)