|
33 |
import copy |
33 |
import copy |
34 |
import types |
34 |
import types |
35 |
import re |
35 |
import re |
|
|
36 |
import sys |
36 |
import time |
37 |
import time |
37 |
import ldap |
38 |
import ldap |
38 |
import ipaddr |
39 |
import ipaddr |
|
|
40 |
import traceback |
39 |
|
41 |
|
40 |
import univention.debug |
42 |
import univention.debug |
41 |
|
43 |
|
|
795 |
al.append( ( 'objectClass', [ 'univentionObject', ] ) ) |
797 |
al.append( ( 'objectClass', [ 'univentionObject', ] ) ) |
796 |
al.append( ( 'univentionObjectType', [ self.module, ] ) ) |
798 |
al.append( ( 'univentionObjectType', [ self.module, ] ) ) |
797 |
|
799 |
|
798 |
self.lo.add(self.dn, al) |
800 |
# if anything goes wrong we need to remove the already created object, otherwise we run into 'already exists' errors |
799 |
|
801 |
try: |
800 |
if hasattr(self,'_ldap_post_create'): |
802 |
added = False |
801 |
# if anything goes wrong we need to remove the already created object, otherwise we run into 'already exists' errors |
803 |
self.lo.add(self.dn, al) |
802 |
try: |
804 |
added = True |
|
|
805 |
if hasattr(self,'_ldap_post_create'): |
803 |
self._ldap_post_create() |
806 |
self._ldap_post_create() |
|
|
807 |
except: |
808 |
# ensure that there is no lock left |
809 |
exc = sys.exc_info() |
810 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "Create operation failed: %s" % (traceback.format_exc(),)) |
811 |
try: |
812 |
self.cancel() |
804 |
except: |
813 |
except: |
805 |
# ensure that there is no lock left |
814 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "create: cancel() failed: %s" % (traceback.format_exc(),)) |
806 |
import traceback, sys |
815 |
try: |
807 |
exc = sys.exc_info() |
816 |
if added: |
808 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "Post-Create operation failed: %s" % (traceback.format_exc(),)) |
|
|
809 |
try: |
810 |
self.cancel() |
811 |
except: |
812 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "Post-create: cancel() failed: %s" % (traceback.format_exc(),)) |
813 |
try: |
814 |
self.remove() |
817 |
self.remove() |
815 |
except: |
818 |
except: |
816 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "Post-create: remove() failed: %s" % (traceback.format_exc(),)) |
819 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, "create: remove() failed: %s" % (traceback.format_exc(),)) |
817 |
raise exc[0], exc[1], exc[2] |
820 |
raise exc[0], exc[1], exc[2] |
818 |
|
821 |
|
819 |
self.call_udm_property_hook('hook_ldap_post_create', self) |
822 |
self.call_udm_property_hook('hook_ldap_post_create', self) |
820 |
|
823 |
|