Bläddra i källkod

Merge pull request #1379 from joelddiaz/zbx-action-diff

handle being passed an empty group list
Joel Diaz 9 år sedan
förälder
incheckning
6cfd632679
1 ändrade filer med 6 tillägg och 6 borttagningar
  1. 6 6
      roles/lib_zabbix/library/zbx_action.py

+ 6 - 6
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