[ZBX-2862] problem with scripts, user groups, and host groups Created: 2010 Aug 11  Updated: 2017 May 30  Resolved: 2010 Dec 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.8.3rc4
Fix Version/s: 1.8.4

Type: Incident report Priority: Major
Reporter: Aleksandrs Saveljevs Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File in-database.png     PNG File script-after.png     PNG File script-before.png    

 Description   

Create a script with specific user and host groups defined (see script-before.png). Then, remove these user and host groups. Note in script-after.png that "Read" is below the "User group" heading. The database record for this script still refers to the deleted groups (see in-database.png).



 Comments   
Comment by richlv [ 2010 Aug 11 ]

when fixing this, it should be decided what to do upon user/host group removal - script can't be made available to all user groups on all host groups, that would be a security issue

Comment by Konstantin Buravcov (Inactive) [ 2010 Dec 06 ]

Decided that a user group can't be deleted if it is used in script. Host group used also can't be deleted.

Comment by Konstantin Buravcov (Inactive) [ 2010 Dec 07 ]

Fixed in dev branch: ZBX-2862

Usergroups and hostgroups used in scripts can't be deleted

Comment by richlv [ 2010 Dec 07 ]

while functionally it seems to work as expected in the dev branch, there seem to be some minor issues.

the frontend errors are :
Group "deleteme" can not be deleted, because it is used in script "deleteme"
[ CUserGroup::delete ] You cannot delete user group used in a script: group [deleteme] is used in script [deleteme]

1. error messages are missing the trailing dot (as discussed before);

2. inconsistent messages.
2.1. it should be decided whether entity references (like names here) should be doublequoted or enclosed in square brackets - or any other style.
2.2. usergroup message also probably should be rewritten in a more formal way :
User group [deleteme] can not be deleted because it is used in script [deleteme]
2.3. hostgroup message never says what kind of a group that is - should say "Host group" at the beginning of the message

3. usergroup deletion api responses
3.1. weird api reaction to incorrect queries :

{"jsonrpc":"2.0","method":"usergroup.delete","params":

{"12":true}

,"auth":"de42619ff2871b5be5e0fc84192ff2fe","id":4}
Response Code: 200
Response Body: {"jsonrpc":"2.0","result":

{"usrgrpids":[true]}

,"id":4}

{"jsonrpc":"2.0","method":"usergroup.delete","params":

{"usrgrpids":12}

,"auth":"de42619ff2871b5be5e0fc84192ff2fe","id":5}
Response Code: 200
Response Body: {"jsonrpc":"2.0","error":

{"code":-32400,"message":"System error.","data":"JSON-rpc error generation failed. No such error: "}

,"id":5}

3.2. response to correct syntax includes nbsp - should it be there ?
"data":"[ CUserGroup::delete ] You cannot delete user group used in a script: group [deleteme] is used in script [deleteme]"

4. attempting to delete such a hostgroup never gives out the real reason (although with the api syntax being quite inconsistent, i'm not really sure i'm using a correct syntax in any of these queries
{"jsonrpc":"2.0","method":"hostgroup.delete","params":[

{"groupid":30}

],"auth":"de42619ff2871b5be5e0fc84192ff2fe","id":5}
Response Code: 200
Response Body: {"jsonrpc":"2.0","error":

{"code":-32602,"message":"Invalid params.","data":"[ CHostGroup::delete ] Cannot delete group"}

,"id":5}

{"jsonrpc":"2.0","method":"hostgroup.delete","params":["30"],"auth":"de42619ff2871b5be5e0fc84192ff2fe","id":5}

Response Code: 200
Response Body: {"jsonrpc":"2.0","error":

{"code":-32500,"message":"Application error.","data":"[ CHostGroup::delete ] You do not have permission to perform this operation"}

,"id":5}

Comment by richlv [ 2010 Dec 08 ]

btw, all these issues aren't directly affecting the fix, so they could be split out in a separate issue so that the actual fix can be merged - would that be ok ?

Comment by richlv [ 2010 Dec 09 ]

1. fixed
2.1. created followup issue for entity referencing at ZBX-3276;
2.2. then maybe we can just remove "You", making the message start with "Cannot delete..."
2.3. what about this one ?
3. & 4. created followup issue for api problems at ZBX-3277

left for this issue : 2.2. + 2.3. code review, good to merge otherwise

Comment by Konstantin Buravcov (Inactive) [ 2010 Dec 14 ]

Error strings changed, code reviewed by Alexei

Comment by richlv [ 2010 Dec 14 ]

good to merge

Comment by Konstantin Buravcov (Inactive) [ 2010 Dec 14 ]

Merged: branches/1.8 16097

Generated at Fri Apr 19 06:09:02 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.