Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-24243

conf.Unmarshal() is unable to initialize defaults if input parameter "v" is nil

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.27, 6.4.12, 7.0.0beta2
    • Agent2 plugin (N)
    • 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:

      1. Check out any branch before changes in ZBXNEXT-9024 which provide a workaround. Alternatively, replace the getPluginOpts() and pluginOptions struct with the ones provided in getPluginOpts.go.
      2. 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.

            wiper Andris Zeila
            mprihodko Mihails Prihodko
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: