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

Undefined index in configuration.importcompare

XMLWordPrintable

    • Sprint 76 (May 2021), Sprint 77 (Jun 2021), Sprint 78 (Jul 2021), Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021), Sprint 82 (Nov 2021), Sprint 83 (Dec 2021), Sprint 84 (Jan 2022), Sprint 85 (Feb 2022), Sprint 86 (Mar 2022), Sprint 87 (Apr 2022), Sprint 88 (May 2022), Sprint 89 (Jun 2022), Sprint 90 (Jul 2022), Sprint 91 (Aug 2022), Sprint 92 (Sep 2022), Sprint 93 (Oct 2022), Sprint 94 (Nov 2022), Sprint 95 (Dec 2022), Sprint 96 (Jan 2023), Sprint 97 (Feb 2023), Sprint 98 (Mar 2023), Sprint 99 (Apr 2023), Sprint 100 (May 2023), Sprint 101 (Jun 2023), Sprint 102 (Jul 2023)
    • 0.125

      (1) PHP runtime error "Undefined index" when missing rules in configuration.importcompare
      Steps to reproduce:

      1. Send request without host groups rules, templates or items, etc.
            "method": "configuration.importcompare",
            "params": {
                "format": "yaml",
                "rules": {
                    "groups": {
                        "createMissing": true,
                        "updateExisting": true
                    },
                    "items": {
                        "createMissing": true,
                        "updateExisting": true
                    }
                },
                "source": "zabbix_export:\n  version: '5.4'\n  date: '2021-05-14T09:24:01Z'\n  groups:\n    -\n      uuid: 3db9df077509459aaba109060764d431\n      name: apitemplate\n  templates:\n    -\n      uuid: 6bc7f3070e0842f3ace4a3606d8bb66e\n      template: apitemplate\n      name: apitemplate\n      groups:\n        -\n          name: apitemplate\n      items:\n        -\n          uuid: 477665165c274f5c98f10136aab236bc\n          name: apiitem\n          key: apiitem\n"
            },
        

      Result: totally empty output. Runtime errors:

      Undefined index: templates [api_jsonrpc.php:63 -> CJsonRpc->execute() -> CLocalApiClient->callMethod() -> CConfiguration->importcompare() -> CConfigurationImportcompare->importcompare() -> CConfigurationImportcompare->compareByStructure() -> CConfigurationImportcompare->applyOptions() -> CConfigFile->{closure}() in include/classes/import/CConfigurationImportcompare.php:235]
      TypeError: array_key_exists() expects parameter 2 to be array, null given in /ui/include/classes/import/CConfigurationImportcompare.php:290
      Stack trace:
      #0 /ui/include/classes/import/CConfigurationImportcompare.php(131): CConfigurationImportcompare->applyOptions()
      #1 /ui/include/classes/import/CConfigurationImportcompare.php(81): CConfigurationImportcompare->compareByStructure()
      #2 /ui/include/classes/api/services/CConfiguration.php(356): CConfigurationImportcompare->importcompare()
      #3 /ui/include/classes/api/clients/CLocalApiClient.php(121): CConfiguration->importcompare()
      #4 /ui/include/classes/core/CJsonRpc.php(75): CLocalApiClient->callMethod()
      #5 /ui/api_jsonrpc.php(63): CJsonRpc->execute()
      #6 {main}
      

      Expected result: no errors. Output maybe:

      {
          "jsonrpc": "2.0",
          "result": [],
          "id": 1
      }
      

      (2) Undefined offset when import new template with graph and unselect "Create new" for items and discovery
      Steps to reproduce:

      1. Create template
      2. Add item, graph with this item and discovery rule
      3. Export file
      4. Delete template
      5. Import file
      6. Uncheck "Create new" for Items and Discovery rules
      7. Import
        zbx_export_templates_graph.yaml

      Result:

      Undefined offset: 10468 [zabbix.php:22 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> CControllerPopupImport->doAction() -> CApiWrapper->__call() -> CFrontendApiWrapper->callMethod() -> CApiWrapper->callMethod() -> CFrontendApiWrapper->callClientMethod() -> CLocalApiClient->callMethod() -> CConfiguration->import() -> CConfigurationImport->import() -> CConfigurationImport->processDiscoveryRules() -> CConfigFile->{closure}() in include/classes/import/CConfigurationImport.php:1320]
      array_key_exists() expects parameter 2 to be array, null given [zabbix.php:22 -> require_once() -> ZBase->run() -> ZBase->processRequest() -> CController->run() -> CControllerPopupImport->doAction() -> CApiWrapper->__call() -> CFrontendApiWrapper->callMethod() -> CApiWrapper->callMethod() -> CFrontendApiWrapper->callClientMethod() -> CLocalApiClient->callMethod() -> CConfiguration->import() -> CConfigurationImport->import() -> CConfigurationImport->processDiscoveryRules() -> CConfigFile->{closure}() in include/classes/import/CConfigurationImport.php:1320]
      

            agriscenko Andrejs Griščenko
            vmurzins Valdis Murzins
            Team A
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: