[ZBX-5684] inconsistency in returned resource types regarding LLD (rule, prototype, created object). no checks for allowed types for some methods. Created: 2012 Oct 10  Updated: 2017 May 30  Resolved: 2012 Nov 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.0.3
Fix Version/s: 2.0.4rc1, 2.1.0

Type: Incident report Priority: Critical
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, lld, prototype
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

trunk rev 30757 (~2.0.3 release)


Issue Links:
Duplicate

 Description   

(1)
Current state:

  • item.get returns all - 0, 1, 2, 4 (normal item, discovery rule, prototype, auto-created item)
  • trigger.get returns only "flags" in 0, 4 (normal trigger, auto-created trigger)
  • graph.get returns only "flags" in 0, 4 (normal graph, auto-created graph)

We have also DiscoveryRule, ItemPrototype, TriggerPrototype and GraphPrototype API classes, they all work correctly and return only appropriate types (I've just tested).

So to be consistent we have to limit the "item.get" method to return only "real" items, i.e. 0 and 4 types only.

Then in documentation:
http://www.zabbix.com/documentation/2.0/manual/appendix/api/item/definitions
need to leave description only for available types.

(2)
Maybe we also need to check how other methods (update ... delete) from Item, Trigger and Graph classes work with rules and prototypes, maybe we have also to limit there the types ?
Yes, we must - I found a bug there (at least one), nasty bug:
try to update "status":0 using "item.update" method for a discovery rule or a prototype or a auto-created item - its "flags" will be silently changed to "0" - i.e. to normal item

"trigger.update" and "graph.update" are ok in this regard and don't allow such incorrect action - "No permissions to referred object or it does not exist!"

Please consider which particular tests I could forget and skip.



 Comments   
Comment by Alexei Vladishev [ 2012 Oct 10 ]

Again, it is all about API validation. It should be part of a single issue, we already have one registered.

zalex_ua ohh, I just started from another issue and probably ended up with this new report because I forgot about the registered ZBX for validation. Ok, I've added a comment there in ZBX-3783 about this issue.
Let's leave this opened as here not only validation described.

alexei well, if we keep reporting multiple bugs per ticket it will never be fixed. hard to read and track any progress. please stick to one ticket one bug report rule.

Comment by Toms (Inactive) [ 2012 Nov 13 ]

Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-5684

Comment by Eduards Samersovs (Inactive) [ 2012 Nov 22 ]

(1) Typo in popup_trexpr.php:553
$myItem = API::Item()->get(array(
'filter' => array('host' => $expr['host'], 'key_' => $expr['item']),
'output' => API_OUTPUT_EXTEND,
'webitems' => true,
'filter' => array('flags' => null)
));

tomtom RESOLVED in r31712
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2012 Nov 22 ]

P.S. see also ZBXNEXT-1525

Comment by Eduards Samersovs (Inactive) [ 2012 Nov 23 ]

(2) "ERROR: No permissions to referred object or it does not exist!" in item prototype configuration edit page when pressing on template link.

tomtom RESOLVED in r31712
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2012 Nov 23 ]

(3) Error in Item popup:
reset() expects parameter 1 to be array, null given [include/items.inc.php:522]

Resolved in ZBXNEXT-20, but note, same lines was modified in ZBX-5684, after synchronization must be re-tested.

tomtom CLOSED

Comment by Eduards Samersovs (Inactive) [ 2012 Nov 27 ]

Tested!

Comment by Toms (Inactive) [ 2012 Nov 28 ]

Fixed in 2.0.4rc1 r31754, 2.1.0 r31760

Comment by Pavels Jelisejevs (Inactive) [ 2012 Nov 28 ]

(4) Please note this in the API changelog.

tomtom RESOLVED

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2012 Nov 29 ]

(5) The itemprototype.get methods doesn't need a webitems parameter: item prototypes are not related to web items at all.

tomtom Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-5684-tr for trunk
and
Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-5684 r31782 for 2.0

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2012 Nov 29 ]

(6) API_OUTPUT_SHORTEN is used in CItemPrototype::get(). It is no longer supported in the trunk and must be removed. It should remain in 2.0 though.

tomtom Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-5684-tr

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2012 Nov 29 ]

TESTED.

Comment by Toms (Inactive) [ 2012 Nov 30 ]

Fixed in 2.1.0 r31800, 2.0.4rc1 r32149

Generated at Fri Mar 29 10:42:12 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.