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

Wrong DB error handling on host tag deletion by network discovery action operation

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 7.0.2rc1, 7.2.0alpha1
    • 7.0.0, 7.2.0alpha1
    • Server (S)
    • None
    • S24-W28/29, S24-W30/31
    • 0.5

      Steps to reproduce:
      Configure a network discovery operation with an action that has an operation that deletes host tags from the database.

      For example, testDiscoveryRules_opDelHostTags() in ui/tests/integration/testDiscoveryRules.php may be used.

      Result:
      The tags are deleted, but the warning message appears in Zabbix server log:

      686515:20240627:173633.027 failed to delete tags from a discovered host, hostid = 10633
      

      An audit log entry saying that the tags are deleted is not added.

      Expected:
      No warning message is written. The audit log entry is written.

      Cause:
      In discovered_host_tags_save(), this condition is used

      if (ZBX_DB_OK == zbx_db_execute("%s", sql))
      

      instead of this one

      if (ZBX_DB_OK <= zbx_db_execute("%s", sql))
      

      zbx_db_execute() returns the number of rows affected. For 2 deleted tags, it would return 2.

      ZBX_DB_OK == 0

            mprihodko Mihails Prihodko
            mprihodko Mihails Prihodko
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: