suffix can now import ldif file
| | |
| | | <else> |
| | | <sequence> |
| | | |
| | | <!--=========== Generate template ==========--> |
| | | <script> |
| | | sys.path.append("%s/phases/parser" % TESTS_DIR ) |
| | | from parser import * |
| | | localTemplateFile = '%s/template.ldif' % (LOG_DIR) |
| | | </script> |
| | | <call function="'generateTemplate'"> |
| | | { 'templateFile' : localTemplateFile } |
| | | </call> |
| | | |
| | | <!--=========== For the first host, copy and run makeldif ======--> |
| | | <script> |
| | |
| | | ldifFile = '%s/data.ldif' % \ |
| | | topoElements[0].getInstanceRef().getInstallDir() |
| | | </script> |
| | | |
| | | |
| | | <!--=== If suffix has already a generated ldif file, copy it ====--> |
| | | <if expr="suffix.getLdifFile() != NOT_DEFINED"> |
| | | <sequence> |
| | | <call function="'copyFile'"> |
| | | { 'location' : topoElements[0].getInstanceRef().getHost(), |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcFile' : suffix.getLdifFile(), |
| | | 'destFile' : ldifFile, |
| | | 'remoteHost' : topoElements[0].getInstanceRef().getHost(), |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | <message> |
| | | '%s : copy ldif file done' % topoElements[0].getInstanceRef().getHost() |
| | | </message> |
| | | </sequence> |
| | | |
| | | |
| | | <!--=== No ldif file provided, Generate it ===--> |
| | | <else> |
| | | <sequence> |
| | | <!--== Generate and copy the template ==--> |
| | | <script> |
| | | sys.path.append("%s/phases/parser" % TESTS_DIR ) |
| | | from parser import * |
| | | localTemplateFile = '%s/template.ldif' % (LOG_DIR) |
| | | </script> |
| | | <call function="'generateTemplate'"> |
| | | { 'templateFile' : localTemplateFile } |
| | | </call> |
| | | <call function="'copyFile'"> |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcFile' : localTemplateFile, |
| | | 'destFile' : templateFile, |
| | | 'remoteHost' : topoElements[0].getInstanceRef().getHost(), |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | <!--== Run make ldif ==--> |
| | | <call function="'makeLdif'"> |
| | | { 'location' : topoElements[0].getInstanceRef().getHost(), |
| | | 'dsPath' : topoElements[0].getInstanceRef().getInstallDir(), |
| | |
| | | 'fileFd' : LOG_MAIN_FD |
| | | } |
| | | </call> |
| | | <message> |
| | | '%s : makeLDIF done' % topoElements[0].getInstanceRef().getHost() |
| | | </message> |
| | | </sequence> |
| | | </else> |
| | | </if> |
| | | |
| | | |
| | | <!--================== Import ldif file =======================--> |
| | | <call function="'ImportLdifWithScript'"> |
| | | { |
| | | 'location' : topoElements[0].getInstanceRef().getHost(), |
| | |
| | | } |
| | | </call> |
| | | <message> |
| | | '%s : makeLDIF done' % topoElements[0].getInstanceRef().getHost() |
| | | '%s : importLDIF done' % topoElements[0].getInstanceRef().getHost() |
| | | </message> |
| | | <script>LOG_MAIN_FD.write('</instance>\n')</script> |
| | | |
| | |
| | | topoMsg = '%s\n</topology>\n' % topoMsg |
| | | |
| | | # SUFFIX DATA |
| | | suffixDataForXml = NOT_DEFINED |
| | | # Get ldif file if specified in conf.xml |
| | | suffixDataForXml = suffix.getLdifFile() |
| | | nbOfEntries = 'unknown' |
| | | # if ldif file is not specified in conf.xml, get the tree data |
| | | if suffixDataForXml == NOT_DEFINED: |
| | | root = suffix.getTree() |
| | | suffixDataForXml = getSuffixDataForXML(suffix.getSuffixDn(),root) |
| | | nbOfEntries = suffix.getNbOfEntries() |
| | | </script> |
| | | <call function="'writeStartTag'"> |
| | | { |
| | |
| | | 'content' : '\n %s \ |
| | | <numberOfEntries>%s</numberOfEntries>\n \ |
| | | %s \n \ |
| | | ' % (topoMsg,suffix.getNbOfEntries(),suffixDataForXml) |
| | | ' % (topoMsg,nbOfEntries,suffixDataForXml) |
| | | } |
| | | </call> |
| | | <call function="'writeEndTag'"> |
| | |
| | | """Describes suffix information, |
| | | tree is a list of Branch objectclasses |
| | | topology is a list of SuffixTopology objectclasses""" |
| | | def __init__(self, sid, dn, topology, nbOfEntries, tree): |
| | | def __init__(self, sid, dn, topology, nbOfEntries, tree, ldifFile): |
| | | self.sid = sid |
| | | self.dn = dn |
| | | self.topology = topology |
| | | self.nbOfEntries = nbOfEntries |
| | | self.tree = tree |
| | | self.ldifFile = ldifFile |
| | | |
| | | def getId(self): |
| | | return self.sid |
| | |
| | | def getTree(self): |
| | | return self.tree |
| | | |
| | | def getLdifFile(self): |
| | | return self.ldifFile |
| | | |
| | | # |
| | | # Class for instance |
| | |
| | | msg = '' |
| | | cSuffixReplServers = NOT_DEFINED |
| | | cNbOfEntries = NOT_DEFINED |
| | | cBranches = NOT_DEFINED |
| | | cLdifFile = NOT_DEFINED |
| | | |
| | | # |
| | | # Parsing second level : instanceList,numberOfEntries,... |
| | |
| | | (msg,thisSubChild.getNodeName()) |
| | | |
| | | elif (thisSubChild.getNodeType() == Node.ELEMENT_NODE and |
| | | thisSubChild.getNodeName() == 'numberOfEntries'): |
| | | cNbOfEntries = _getPropValue(thisSubChild) |
| | | thisSubChild.getNodeName() == 'ldifFile'): |
| | | cLdifFile = _getPropValue(thisSubChild) |
| | | cLdifFile = cLdifFile.strip() |
| | | |
| | | # parsing suffix TREE |
| | | elif (thisSubChild.getNodeType() == Node.ELEMENT_NODE and |
| | |
| | | else: |
| | | msg = '%s\n ERROR: parseSuffix() : no children for suffix node' % msg |
| | | |
| | | return [msg,Suffix(cId,cSuffixName,cSuffixReplServers,cNbOfEntries,cBranches)] |
| | | return [msg,Suffix(cId,cSuffixName,cSuffixReplServers,\ |
| | | cNbOfEntries,cBranches,cLdifFile)] |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | <!-- ========== SUFFIX NODE ========================= --> |
| | | <!ELEMENT suffix (topology,tree)> |
| | | <!ELEMENT suffix (topology,ldifFile?,tree?)> |
| | | <!ATTLIST suffix |
| | | dn CDATA #REQUIRED> |
| | | |
| | |
| | | initRule ( importLdif | totalUpdate ) "importLdif" |
| | | instanceSourceName NMTOKEN #IMPLIED> |
| | | |
| | | <!ELEMENT ldifFile (#PCDATA)> |
| | | |
| | | <!ELEMENT tree (branch+,subordinateTemplate*)> |
| | | <!ATTLIST tree nbOfEntries CDATA #REQUIRED> |