mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Get-IcingaCheckCommandConfig: provide vars.ifw_api_arguments in each command
to properly support just importing the ifw-api command. That command e.g. takes DSL/JSON arrays [], not PS ones @(). Similar with strings. Therefore set vars.ifw_api_arguments as ifw-api expects.
This commit is contained in:
parent
e06e781f39
commit
e17adcce54
1 changed files with 13 additions and 1 deletions
|
|
@ -211,7 +211,9 @@ function Get-IcingaCheckCommandConfig()
|
|||
'imports' = @( 'PowerShell Base' );
|
||||
'object_name' = $check;
|
||||
'object_type' = 'object';
|
||||
'vars' = @{ };
|
||||
'vars' = @{
|
||||
'ifw_api_arguments' = @{ };
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -313,6 +315,16 @@ function Get-IcingaCheckCommandConfig()
|
|||
);
|
||||
}
|
||||
|
||||
if ($parameter.type.name -eq 'SwitchParameter') {
|
||||
$Basket.Command[$check].vars.ifw_api_arguments.Add([string]::Format('-{0}', $parameter.Name), @{
|
||||
'set_if' = $IcingaCustomVariable;
|
||||
});
|
||||
} else {
|
||||
$Basket.Command[$check].vars.ifw_api_arguments.Add([string]::Format('-{0}', $parameter.Name), @{
|
||||
'value' = $IcingaCustomVariable;
|
||||
});
|
||||
}
|
||||
|
||||
# Determine wether a parameter is required based on given syntax-information
|
||||
if ($parameter.required -eq $TRUE) {
|
||||
$Required = 'y';
|
||||
|
|
|
|||
Loading…
Reference in a new issue