Skip to content

Commit

Permalink
fix: doc_id for base (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar authored Jan 10, 2022
1 parent 3b626ee commit eb0801e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions setup_app/utils/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,10 @@ def get_clean_objcet_class(self, entry):

def get_doc_id_from_dn(self, dn):
dn_parsed = dnutils.parse_dn(dn)
return dn_parsed[0][1]
doc_id = dn_parsed[0][1]
if doc_id == 'jans':
doc_id = '_'
return doc_id

def get_spanner_table_for_dn(self, dn):
tables = self.spanner.get_tables()
Expand Down Expand Up @@ -849,7 +852,7 @@ def import_ldif(self, ldif_files, bucket=None, force=None):
if objectClass.lower() == 'organizationalunit':
continue

vals['doc_id'] = dn_parsed[0][1]
vals['doc_id'] = self.get_doc_id_from_dn(dn)
vals['dn'] = dn
vals['objectClass'] = objectClass

Expand Down Expand Up @@ -888,7 +891,6 @@ def import_ldif(self, ldif_files, bucket=None, force=None):

if 'add' in entry and 'changetype' in entry:
table = self.get_spanner_table_for_dn(dn)
doc_id = self.get_doc_id_from_dn(dn)
change_attr = entry['add'][0]
if table:
doc_id = self.get_doc_id_from_dn(dn)
Expand Down Expand Up @@ -936,7 +938,7 @@ def import_ldif(self, ldif_files, bucket=None, force=None):
if objectClass.lower() == 'organizationalunit':
continue

doc_id = dn_parsed[0][1]
doc_id = self.get_doc_id_from_dn(dn)
vals['doc_id'] = doc_id
vals['dn'] = dn
vals['objectClass'] = objectClass
Expand Down

0 comments on commit eb0801e

Please sign in to comment.