From 97e9309db3708e839bd54bef442bf7296284eac6 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 19 Nov 2010 14:56:25 -0500 Subject: Gracefully handle an empty members list This can occur if you do something like: $ ipa hbac-add-host --hosts="" testrule options will have an entry for 'host' but it will be None whcih is not iterable. ticket 486 --- ipalib/plugins/baseldap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipalib/plugins/baseldap.py') diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 8f723b99..dfde0a21 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -864,7 +864,10 @@ class LDAPModMember(LDAPQuery): for ldap_obj_name in self.obj.attribute_members[attr]: dns[attr][ldap_obj_name] = [] failed[attr][ldap_obj_name] = [] - for name in options.get(to_cli(ldap_obj_name), []): + names = options.get(to_cli(ldap_obj_name), []) + if not names: + continue + for name in names: if not name: continue ldap_obj = self.api.Object[ldap_obj_name] -- cgit