diff options
author | Joel Diaz <jdiaz@redhat.com> | 2016-02-10 16:04:08 -0500 |
---|---|---|
committer | Joel Diaz <jdiaz@redhat.com> | 2016-02-10 16:11:23 -0500 |
commit | 77517fcaeaf3304c900bd108557f847942e873a2 (patch) | |
tree | 5e385ad1939aed94a0a7e74bdd9997773b67249e /roles/lib_zabbix/library | |
parent | bc39e1716b09af021da76e9e390111fcd0d9789a (diff) | |
download | openshift-77517fcaeaf3304c900bd108557f847942e873a2.tar.gz openshift-77517fcaeaf3304c900bd108557f847942e873a2.tar.bz2 openshift-77517fcaeaf3304c900bd108557f847942e873a2.tar.xz openshift-77517fcaeaf3304c900bd108557f847942e873a2.zip |
handle being passed an empty group list
Previous version would have the behavior where when an empty list is passed, the zbx API call would return a list of all groups. So an action with no groups defined would default to having all groups added to the operations.
Handle this by iterating one at a time through the list of provided groups. When an empty list is provided, and empty list is returned.
Diffstat (limited to 'roles/lib_zabbix/library')
-rw-r--r-- | roles/lib_zabbix/library/zbx_action.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/roles/lib_zabbix/library/zbx_action.py b/roles/lib_zabbix/library/zbx_action.py index 2f9524556..c388a65cc 100644 --- a/roles/lib_zabbix/library/zbx_action.py +++ b/roles/lib_zabbix/library/zbx_action.py @@ -228,12 +228,12 @@ def get_user_groups(zapi, groups): '''get the mediatype id from the mediatype name''' user_groups = [] - content = zapi.get_content('usergroup', - 'get', - {'search': {'name': groups}}) - - for usr_grp in content['result']: - user_groups.append({'usrgrpid': usr_grp['usrgrpid']}) + for group in groups: + content = zapi.get_content('usergroup', + 'get', + {'search': {'name': group}}) + for result in content['result']: + user_groups.append({'usrgrpid': result['usrgrpid']}) return user_groups |