[ZBX-4621] Updating macros using Host.massUpdate() Created: 2012 Feb 07  Updated: 2017 May 30  Resolved: 2012 Mar 20

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 1.9.8 (beta)
Fix Version/s: 2.0.0rc2

Type: Incident report Priority: Major
Reporter: Pavels Jelisejevs (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: API, hosts, macros, massupdate
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If we have a couple of hosts, one of which has a host macro with hostmacroid 28, then the following API request will update the given macro, but delete all of the other macros on both hosts.

API::Host()->massUpdate(array(
'macros' => array(
'hostmacroid' => 28,
'macro' => '{$C}',
'value' => 3
),
'hosts' => array(
array('hostid' => 10116),
array('hostid' => 10091),
)
));

This seems illogical, the massUpdate method should just replace all of the macros on both hosts with the given macros, and passing a 'hostmacroid' should probably trigger an error.

I haven't checked, but there maybe similar problems with other massUpdate methods.



 Comments   
Comment by Alexey Fukalov [ 2012 Mar 19 ]

dev branch: svn://svn.zabbix.com/branches/dev/ZBX-4621

Comment by Toms (Inactive) [ 2012 Mar 20 ]

(1) How does replaceMacros() function relate to this issue?

<Vedmak> hmm, it's used to implement functionality required by this issue. We can discuss if there are another ways to implement it in better way.

<Toms> CLOSED

Comment by Toms (Inactive) [ 2012 Mar 20 ]

(2) Old "// UPDATE MACROS {{{" comment were more convenient

<Vedmak> but we don't use such comments now.

<Toms> CLOSED

Comment by Toms (Inactive) [ 2012 Mar 20 ]

TESTED

Comment by Alexey Fukalov [ 2012 Mar 20 ]

svn://svn.zabbix.com/trunk 26233

Generated at Sat Apr 27 03:47:59 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.