API 'maintenance.get' sets internally invalid options for related query

XMLWordPrintable

    • Type: Incident report
    • Resolution: Fixed
    • Priority: Trivial
    • None
    • Affects Version/s: 2.0.13, 2.2.6
    • Component/s: API (A)
    • Environment:
      'maintenance.get' with 'hostids' or/and 'groupids' parameter(s)

      CMaintenance.php / function get

      if user presets 'groupids' parameter,
      this function overrides 'selectGroups' parameter by value '1'

      if (!is_null($options['groupids']))

      { $options['selectGroups'] = 1; }


      so if user sets 'selectGroups' parameter (e.g.'extend') was lost..

      'selectGroups' parameter is used later at calls 'addRelatedObjects' function.
      this function internally calls api 'hostgroup.get',
      value of 'selectGroups' is set to 'hostgroup.get' 's 'output' parameter.

      Value '1' might be invalid...
      value of 'output' should be 'api query settings' e.g.'extend' 'refer'...

      I think as follows
      if user not presets 'selectGroups' parameter, then it needs set to 'refer'

      if (!is_null($options['groupids'])) {
      if (is_null($options['selectGroups']))

      { $options['selectGroups'] = API_OUTPUT_REFER; }

      }

      There is the same issue with 'hosts' and 'selectHosts'...

        1. ZBX-8883.2.0.13.patch
          0.8 kB
          Fripper
        2. ZBX-8883.2.2.6.patch
          0.8 kB
          Fripper

            Assignee:
            Unassigned
            Reporter:
            Fripper
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: