summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/group.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-04-19 08:06:32 -0400
committerMartin Kosek <mkosek@redhat.com>2012-04-26 09:00:30 +0200
commit3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c (patch)
tree5d9025bddb28f6be6aecf853e37d13aa1b78dc0f /ipalib/plugins/group.py
parent856b9627beaca89fde6904cdea398ac817faf321 (diff)
downloadfreeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.tar.gz
freeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.tar.xz
freeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.zip
Refactor exc_callback invocation.
Replace _call_exc_callbacks with a function wrapper, which will automatically call exception callbacks when an exception is raised from the function. This removes the need to specify the function and its arguments twice (once in the function call itself and once in _call_exc_callbacks). Add some extra checks to existing exception callbacks.
Diffstat (limited to 'ipalib/plugins/group.py')
-rw-r--r--ipalib/plugins/group.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 096cb9eae..13208542c 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -211,9 +211,10 @@ class group_mod(LDAPUpdate):
def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs):
# Check again for GID requirement in case someone tried to clear it
# using --setattr.
- if isinstance(exc, errors.ObjectclassViolation):
- if 'gidNumber' in exc.message and 'posixGroup' in exc.message:
- raise errors.RequirementError(name='gid')
+ if call_func.func_name == 'update_entry':
+ if isinstance(exc, errors.ObjectclassViolation):
+ if 'gidNumber' in exc.message and 'posixGroup' in exc.message:
+ raise errors.RequirementError(name='gid')
raise exc
api.register(group_mod)