Changeset 331 for n4d-ldap/trunk
- Timestamp:
- Feb 4, 2016, 12:21:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
n4d-ldap/trunk/fuentes/install/usr/share/n4d/python-plugins/SlapdManager.py
r149 r331 135 135 136 136 try: 137 self.connect_ldapi.modify_s('olcDatabase={1} hdb,cn=config',remove_acl)137 self.connect_ldapi.modify_s('olcDatabase={1}mdb,cn=config',remove_acl) 138 138 except: 139 139 pass 140 140 try: 141 self.connect_ldapi.modify_s('olcDatabase={1} hdb,cn=config',modify_list)141 self.connect_ldapi.modify_s('olcDatabase={1}mdb,cn=config',modify_list) 142 142 except Exception as e: 143 143 return {"status":False,"msg":str(e)} … … 177 177 @try_connect 178 178 def update_index(self,index,add_index=True): 179 179 180 180 searching_backend = self.connect_ldapi.search_s('cn=config',ldap.SCOPE_SUBTREE,filterstr='(objectClass=olcBackendConfig)',attrlist=['olcBackend']) 181 181 if len(searching_backend) > 0 : … … 183 183 else: 184 184 return {"status":False,"msg":"not found backend for OpenLdap"} 185 185 186 186 187 searching_database = self.connect_ldapi.search_s('cn=config',ldap.SCOPE_SUBTREE,filterstr='(olcDatabase~='+backend+')',attrlist=['olcDbIndex']) … … 189 190 else: 190 191 return {"status":False,"msg":"not found database config on OpenLdap"} 192 191 193 if aux_index.has_key('olcDbIndex'): 192 194 old_Index = aux_index['olcDbIndex'] 193 195 else: 194 196 old_Index = [] 197 195 198 list_index = old_Index[:] 196 199 if type(index) == type([]): … … 208 211 list_index.remove(index) 209 212 list_index = list(set(list_index)) 210 remove_acl = [(ldap.MOD_DELETE,'olcDbIndex',None)] 211 modify_list = [(ldap.MOD_ADD,'olcDbIndex',list_index)] 212 213 remove_acl = [(ldap.MOD_DELETE,'olcDbIndex',[""])] 214 modify_list = [(ldap.MOD_REPLACE,'olcDbIndex',list_index)] 213 215 try: 214 216 self.connect_ldapi.modify_s(cn,remove_acl) 215 except :217 except Exception as e: 216 218 pass 217 219 try: … … 347 349 modify_list = [(ldap.MOD_DELETE, 'olcRootPW', None), (ldap.MOD_ADD, 'olcRootPW', ssha_password)] 348 350 try: 349 self.connect_ldapi.modify_s('olcDatabase={1} hdb,cn=config',modify_list)351 self.connect_ldapi.modify_s('olcDatabase={1}mdb,cn=config',modify_list) 350 352 except Exception as e: 351 353 return {"status":False,"msg":e[0]["desc"]} … … 678 680 def enable_overlay_data(self): 679 681 x = {'objectClass': ['olcOverlayConfig', 'olcSyncProvConfig'], 'olcOverlay': 'syncprov'} 680 dn = 'olcDatabase={1} hdb,cn=config'682 dn = 'olcDatabase={1}mdb,cn=config' 681 683 try: 682 684 result = self.connect_ldapi.search_s(dn,ldap.SCOPE_ONELEVEL) … … 776 778 @try_connect 777 779 def add_rid_data(self, rid, ip, password, rootdn, basedn): 778 dn = 'olcDatabase={1} hdb,cn=config'780 dn = 'olcDatabase={1}mdb,cn=config' 779 781 ''' 780 782 rid … … 903 905 @try_connect 904 906 def enable_syncprov_checkpoint(self,num_changes,minutes): 905 dn = 'olcOverlay={0}syncprov,olcDatabase={1} hdb,cn=config'907 dn = 'olcOverlay={0}syncprov,olcDatabase={1}mdb,cn=config' 906 908 907 909 delete_chages = [(ldap.MOD_DELETE,'olcSpCheckpoint')] … … 920 922 @try_connect 921 923 def add_rid_data_simple_sync(self, rid, ip, password, rootdn, basedn): 922 dn = 'olcDatabase={1} hdb,cn=config'924 dn = 'olcDatabase={1}mdb,cn=config' 923 925 ''' 924 926 rid … … 943 945 @try_connect 944 946 def add_updateref_data(self,ip): 945 dn = 'olcDatabase={1} hdb,cn=config'947 dn = 'olcDatabase={1}mdb,cn=config' 946 948 try: 947 949 changes = [] … … 1056 1058 return True 1057 1059 except Exception as e: 1058 print "\n\nError" + str(e) + "\n\n"1059 1060 self.connect_ldap = None 1060 1061 return False
Note: See TracChangeset
for help on using the changeset viewer.