kolab 3 upgrade from 2

Chloé Desoutter chloe.desoutter at atasta.net
Tue Apr 30 11:07:46 CEST 2013


Le 30/04/2013 10:39, Gábor István a écrit :
> Hi all,
>
Hi Gabor,

We have designed a procedure that has not been advertised here. 
Basically, you dump a LDIF, you transform it and you reimport it.

Here is the script we built and pushed on this ML (attached).

You need Python and python-ldif to run it. Change the default vars and 
re-import it into 389DS.

Yours sincerely
-- 
Chloé Desoutter
ATASTANET
-------------- next part --------------
#!/usr/bin/env python
# (c) 2012 Atasta
# by Chloé Desoutter <chloe.desoutter at atasta.net>
# GPL v2

import sys
from ldif import LDIFParser,LDIFWriter

class ReadK21(LDIFParser):
  def __init__(self,i,o):
    LDIFParser.__init__(self, i)
    self.writer = LDIFWriter(o)
  def handle(self, dn, entry):
    defaultTN = '+33300000000'
    defaultMB = '+33600000000'
    defaultCt = 'Paris'
    defaultO = 'My Company'
    defaultMailHost = 'smtp.my-company.com'
    defaultZip = '01000'
    defaultStr = 'Main Street 3'
    defaultLng = 'en_US'
    defaultOu = 'ou=people,dc=mycompany,dc=com'
    defaultTt = 'Employee'
    if ("ou=People" in dn and "uid=" in dn):
#      print str(entry)
      newE = {}
      newE['telephoneNumber'] = [defaultTN]
      newE['l']=[defaultCt]
      newE['o']=[defaultO]
#      newE['countryName'] = ['France']
      newE['postalCode'] = [defaultZip]
      newE['street'] = [defaultStre]
      newE['mobile'] = [defaultMB]
      newE['mailHost'] = [defaultMailHost]
      newE['objectClass'] = ['person', 'organizationalperson', 'mailrecipient', 'kolabinetorgperson', 'inetorgperson', 'top']
      newE['preferredLanguage'] = [defaultLng]
      newE['ou'] = [defaultOu]
      newE['initials'] = ["__"]
      newE['alias'] = []
      newE['title'] = [defaultTt]
      for k,v in entry.items():
        if (k == "uid" or k == 'displayName' or k == 'cn' or k == 'uid' or k == 'userPassword' or k == 'givenName' or k == 'mail' or k == 'sn' or k == 'alias'):
          newE[k] = v
      self.writer.unparse(dn, newE)


parser21 = ReadK21(open(sys.argv[1],"r"), sys.stdout)

parser21.parse()


More information about the users mailing list