diff options
author | Pavel Zuna <pzuna@redhat.com> | 2009-07-02 15:17:50 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-07-02 13:33:05 -0400 |
commit | 537ba4034d6d5af77b13ff0d954247bb39b1fa5a (patch) | |
tree | 5bd5b6c0157faf972cb984f2b64702730cae5a2d /ipalib/plugins/hostgroup.py | |
parent | 5e4c0014df46cd9a00ec8b8099533522cbbc1448 (diff) | |
download | freeipa-537ba4034d6d5af77b13ff0d954247bb39b1fa5a.tar.gz freeipa-537ba4034d6d5af77b13ff0d954247bb39b1fa5a.tar.xz freeipa-537ba4034d6d5af77b13ff0d954247bb39b1fa5a.zip |
Make basegroup-{add, del}-member print failed members with error descriptions.
Diffstat (limited to 'ipalib/plugins/hostgroup.py')
-rw-r--r-- | ipalib/plugins/hostgroup.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py index 272d5720d..1147083cd 100644 --- a/ipalib/plugins/hostgroup.py +++ b/ipalib/plugins/hostgroup.py @@ -136,7 +136,7 @@ class hostgroup_add_member(basegroup_add_member): 'cn', cn, self.filter_class, [''], self.container ) to_add = [] - add_failed = [] + add_failed = {} completed = 0 members = kw.get('groups', []) @@ -166,7 +166,9 @@ class hostgroup_add_member(basegroup_add_member): ldap, completed, to_add, add_failed, dn, 'member' ) - return (completed, ldap.get_entry(dn, self.default_attributes)) + return ( + completed, add_failed, ldap.get_entry(dn, self.default_attributes) + ) api.register(hostgroup_add_member) @@ -208,37 +210,39 @@ class hostgroup_del_member(basegroup_del_member): 'cn', cn, self.filter_class, [''], self.container ) to_remove = [] - remove_failed = [] + rem_failed = {} completed = 0 members = kw.get('groups', []) - (to_remove, remove_failed) = find_members( - ldap, remove_failed, members, 'cn', 'ipausergroup', + (to_remove, rem_failed) = find_members( + ldap, rem_failed, members, 'cn', 'ipausergroup', self.api.env.container_group ) - (completed, remove_failed) = del_members( - ldap, completed, to_remove, remove_failed, dn, 'member' + (completed, rem_failed) = del_members( + ldap, completed, to_remove, rem_failed, dn, 'member' ) members = kw.get('hosts', []) - (to_remove, remove_failed) = find_members( - ldap, remove_failed, members, 'cn', 'ipahost', + (to_remove, rem_failed) = find_members( + ldap, rem_failed, members, 'cn', 'ipahost', self.api.env.container_host ) - (completed, remove_failed) = del_members( - ldap, completed, to_remove, remove_failed, dn, 'member' + (completed, rem_failed) = del_members( + ldap, completed, to_remove, rem_failed, dn, 'member' ) members = kw.get('hostgroups', []) - (to_remove, remove_failed) = find_members( - ldap, remove_failed, members, 'cn', 'ipahostgroup', + (to_remove, rem_failed) = find_members( + ldap, rem_failed, members, 'cn', 'ipahostgroup', self.api.env.container_hostgroup ) - (completed, remove_failed) = del_members( - ldap, completed, to_remove, remove_failed, dn, 'member' + (completed, rem_failed) = del_members( + ldap, completed, to_remove, rem_failed, dn, 'member' ) - return (completed, ldap.get_entry(dn, _default_attributes)) + return ( + completed, rem_failed, ldap.get_entry(dn, _default_attributes) + ) api.register(hostgroup_del_member) |