[ZBX-7316] drule.delete is not working Created: 2013 Nov 07  Updated: 2017 May 30  Resolved: 2013 Nov 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.0rc2
Fix Version/s: 2.2.1rc1, 2.3.0

Type: Incident report Priority: Major
Reporter: Pavels Jelisejevs (Inactive) Assignee: Ivo Kurzemnieks
Resolution: Fixed Votes: 0
Labels: api, discoveryrule
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The request is executed without any errors by the discovery rule is not deleted.

Request:

{ "jsonrpc": "2.0", "method": "drule.delete", "params": [ "3" ], "id": 11, "auth": "21b3cfb218164e813fd81b80ae155086" }

Response:

{
"jsonrpc": "2.0",
"result":

{ "druleids": [ "3" ] }

,
"id": 11
}



 Comments   
Comment by Ivo Kurzemnieks [ 2013 Nov 08 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-7316

Comment by Pavels Jelisejevs (Inactive) [ 2013 Nov 08 ]

(1) Could you please replace delete_discovery_rule() calls with drule.delete in discoveryconf.php? To make sure that the method doesn't remain unused.

iivs RESOLVED in r40138

jelisejev When trying to delete a non-existing discovery rule, the frontend displays a fatal "ERROR: No permissions to referred object or it does not exist!" message. It should display a standard "Cannot delete discovery rule" message and display the rest of the page. The same way as in other places.

iivs RESOLVED in r40150

jelisejev CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Nov 08 ]

(2) drule.delete accepts any ID in array and doesn't check if that ID exists or not. And it also accepts empty parameters. It requires validation.

iivs RESOLVED in r40141

jelisejev Some validation code issues:

  • we don't use empty();
  • validation must be implemented in a separate validateDelete() method;
  • the permission check must be implemented in a separate check method (similarly to the CHostPrototype::checkHostPrototypePermissions()) method.

Also please revert the changes the the returned value.

iivs RESOLVED in r40150
I also corrected documentation regarding retun property 'druleids'

jelisejev Thanks, I've also corrected the 2.0 docs https://www.zabbix.com/documentation/2.0/manual/appendix/api/drule/delete

Please, move the validate method after delete(). It's better that they be grouped together.

iivs Ok, RESOLVED in r40251

CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Nov 13 ]

TESTED, but please finish (2) before merging.

Comment by Ivo Kurzemnieks [ 2013 Nov 13 ]

Fixed in pre-2.2.1rc1 r40260 and 2.3.0 (trunk) r40259

Generated at Sat Apr 20 13:03:36 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.