summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-07-24 12:33:35 +0200
committerTomas Babej <tbabej@redhat.com>2014-09-17 14:41:50 +0200
commite848eed598df44427ee480ec25733b72255752f1 (patch)
tree1c5ea1155ae07fcc7b46721b2466a9e1bff5cab8
parent1f8f762b84e7448cb279b6db5158f93b5f517827 (diff)
downloadfreeipa-e848eed598df44427ee480ec25733b72255752f1.zip
freeipa-e848eed598df44427ee480ec25733b72255752f1.tar.gz
freeipa-e848eed598df44427ee480ec25733b72255752f1.tar.xz
baseldap: Fix undefined variable reference in LDAPAddReverseMember and LDAPRemoveReverseMember
-rw-r--r--ipalib/plugins/baseldap.py44
1 files changed, 18 insertions, 26 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 26b43b9..a3cfe3c 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -2100,19 +2100,15 @@ class LDAPAddReverseMember(LDAPModReverseMember):
for attr in options.get(self.reverse_attr) or []:
try:
options = {'%s' % self.member_attr: keys[-1]}
- try:
- result = self._exc_wrapper(keys, options, self.api.Command[self.member_command])(attr, **options)
- if result['completed'] == 1:
- completed = completed + 1
- else:
- failed['member'][self.reverse_attr].append((attr, result['failed']['member'][self.member_attr][0][1]))
- except errors.NotFound, e:
- msg = str(e)
- (attr, msg) = msg.split(':', 1)
- failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
-
- except errors.PublicError, e:
- failed['member'][self.reverse_attr].append((attr, unicode(msg)))
+ result = self._exc_wrapper(keys, options, self.api.Command[self.member_command])(attr, **options)
+ if result['completed'] == 1:
+ completed = completed + 1
+ else:
+ failed['member'][self.reverse_attr].append((attr, result['failed']['member'][self.member_attr][0][1]))
+ except (errors.PublicError, errors.NotFound) as e:
+ msg = str(e)
+ (attr, msg) = msg.split(':', 1)
+ failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
# Update the member data.
entry_attrs = ldap.get_entry(dn, ['*'])
@@ -2201,19 +2197,15 @@ class LDAPRemoveReverseMember(LDAPModReverseMember):
for attr in options.get(self.reverse_attr) or []:
try:
options = {'%s' % self.member_attr: keys[-1]}
- try:
- result = self._exc_wrapper(keys, options, self.api.Command[self.member_command])(attr, **options)
- if result['completed'] == 1:
- completed = completed + 1
- else:
- failed['member'][self.reverse_attr].append((attr, result['failed']['member'][self.member_attr][0][1]))
- except errors.NotFound, e:
- msg = str(e)
- (attr, msg) = msg.split(':', 1)
- failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
-
- except errors.PublicError, e:
- failed['member'][self.reverse_attr].append((attr, unicode(msg)))
+ result = self._exc_wrapper(keys, options, self.api.Command[self.member_command])(attr, **options)
+ if result['completed'] == 1:
+ completed = completed + 1
+ else:
+ failed['member'][self.reverse_attr].append((attr, result['failed']['member'][self.member_attr][0][1]))
+ except (errors.PublicError, errors.NotFound) as e:
+ msg = str(e)
+ (attr, msg) = msg.split(':', 1)
+ failed['member'][self.reverse_attr].append((attr, unicode(msg.strip())))
# Update the member data.
entry_attrs = ldap.get_entry(dn, ['*'])