-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
6.0.27, 6.4.12, 7.0.0beta2
-
None
conf.Unmarshal() in plugin-support repo is unable to initialize defaults of the "data" parameter form its struct tags, if input parameter "v" is nil.{}
Steps to reproduce:
- Check out any branch before changes in
ZBXNEXT-9024which provide a workaround. Alternatively, replace the getPluginOpts() and pluginOptions struct with the ones provided in getPluginOpts.go. - Optional step, which is useful for testing. Configure a loadable plugin, for example, https://git.zabbix.com/projects/AP/repos/postgresql/browse. Do not configure "System.Capacity" in the plugin config file.
Result:
Default "System.Capacity" for the built-in plugins was not initialized from struct tags in pluginOptions struct. optsRaw parameter in getPluginOpts() is nil.
At the same time, "System.Capacity" is initialized for the loadable PostgreSQL plugin, because it has "optsRaw" (if you configured it).
Expected:
func Unmarshal(data interface{}, v interface{}, args ...interface{}) (err error)
in plugin-support repo should be modified so that it does not require the "v" parameter to initialize the "data" parameter with default values from its struct tags. A developer should be able to modify getPluginOpts() in Zabbix agent 2 so that the workaround implemented in ZBXNEXT-9024 for Zabbix 6.4 to initialize the default values of "opt" in getPluginOpts() is not required anymore.