Skip to content

Commit 0469908

Browse files
authored
Merge pull request #162 from Icinga:feature/add_exception_plugin_args_64_digits
Feature: Adds error on config generator for 64 digit args Adds feature to test the length of plugin custom variables during config generation and throws error in case the total length is bigger than 64 digits, as imports into the Icinga Director by using baskets is not possible otherwise
2 parents 985a142 + ba131e7 commit 0469908

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2323
* [#142](https://github.com/Icinga/icinga-powershell-framework/pull/142) **Experimental:** Adds feature to cache the Framework code into a single file to speed up the entire loading process, mitigating the impact on performance on systems with few CPU cores. You enable disables this feature by using `Enable-IcingaFrameworkCodeCache` and `Disable-IcingaFrameworkCodeCache`. Updating the cache is done with `Write-IcingaFrameworkCodeCache`
2424
* [#149](https://github.com/Icinga/icinga-powershell-framework/pull/149) Adds support to add Wmi permissions for a specific user and namespace with `Add-IcingaWmiPermissions`. In addition you can remove users from Wmi namespaces by using `Remove-IcingaWmiPermissions`
2525
* [#155](https://github.com/Icinga/icinga-powershell-framework/pull/155) Adds support to write all objects collected by `Get-IcingaWindowsInformation` into the Windows EventLog in case the debug output for the Icinga PowerShell Framework is enabled.
26+
* [#162](https://github.com/Icinga/icinga-powershell-framework/pull/162) Adds feature to test the length of plugin custom variables during config generation and throws error in case the total length is bigger than 64 digits, as imports into the Icinga Director by using baskets is not possible otherwise
2627

2728
### Bugfixes
2829

doc/icingaintegration/01-Director-Baskets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Get-IcingaCheckCommandConfig -CheckName Invoke-IcingaCheckBiosSerial, Invoke-Ici
3131
Last but not least you can output the JSON-Basket directly into a file. To do this, simply use the `OutDirectory` argument. You only require to specify a directory here, as the file including a timestamp is generated by the Cmdlet itself
3232

3333
```powershell
34-
Get-IcingaCheckCommandConfig -OutDirectory 'C:\Users\myuser\Documents\
34+
Get-IcingaCheckCommandConfig -OutDirectory 'C:\Users\myuser\Documents\'
3535
```
3636

3737
Once the file is exported, you can navigate to your Icinga Director Basket menu and import the generated file. Afterwards all specified Check-Commands are available and ready to use

lib/core/tools/Get-IcingaCheckCommandConfig.psm1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ function Get-IcingaCheckCommandConfig()
140140

141141
$IcingaCustomVariable = [string]::Format('${0}_{1}_{2}$', $PluginNameSpace, (Get-Culture).TextInfo.ToTitleCase($parameter.type.name), $parameter.Name);
142142

143+
if ($IcingaCustomVariable.Length -gt 66) {
144+
Write-IcingaConsoleError 'The argument "{0}" for the plugin "{1}" is too long. The maximum size of generated custom variables is 64 digits. Current argument size: "{2}", Name: "{3}"' -Objects $parameter.Name, $check, ($IcingaCustomVariable.Length - 2), $IcingaCustomVariable.Replace('$', '');
145+
return;
146+
}
147+
143148
# Todo: Should we improve this? Actually the handling would be identical, we just need to assign
144149
# the proper field for this
145150
if ($IcingaCustomVariable -like '*_Int32_Verbose$' -Or $IcingaCustomVariable -like '*_Int_Verbose$' -Or $IcingaCustomVariable -like '*_Object_Verbose$') {

0 commit comments

Comments
 (0)