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

Undefined index in configuration.importcompare

    XMLWordPrintable

Details

    • Team B
    • 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)
    • 0.125

    Description

      (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]
      

      Attachments

        Issue Links

          Activity

            People

              vmurzins Valdis Murzins
              vmurzins Valdis Murzins
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: