| | |
| | | myRC = 0 |
| | | failedServers = [] |
| | | failingServerList = '' |
| | | referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME) |
| | | referenceTree = 'referenceTree.ldif' |
| | | sampleTree = 'sampleTree.ldif' |
| | | treeDiffs = 'treeDiffs.ldif' |
| | | </script> |
| | | |
| | | |
| | | <message> |
| | | 'Verify tree %s taking %s as reference.' % (treeSuffix, referenceServerPath) |
| | | </message> |
| | | |
| | | <!-- Retrieve the tree from the reference server --> |
| | | <call function="'ldapSearchWithScript'"> |
| | | { 'location' : location, |
| | |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | <function name="verifySchemas"> |
| | | <function-prolog> |
| | | This function verifies that a schema file is synchronized all over a group of servers. |
| | | </function-prolog> |
| | | |
| | | <function-list-args> |
| | | <function-arg-def name="location" type="optional" default="'%s' % STAXServiceMachine"> |
| | | <function-arg-description> |
| | | Location of target host |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="hostname"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)"> |
| | | <function-arg-description> |
| | | Pathname to installation root |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="filepath"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="referenceServer" type="required"> |
| | | <function-arg-description> |
| | | Server that should be taken as reference. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Server"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="serverList" type="required"> |
| | | <function-arg-description> |
| | | List of the servers to verify against the referenceServer. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Server-list"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="schemaFile" type="required"> |
| | | <function-arg-description> |
| | | Schema file to verify. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="filename"/> |
| | | </function-arg-def> |
| | | </function-list-args> |
| | | |
| | | |
| | | |
| | | <sequence> |
| | | |
| | | <script> |
| | | myRC = 0 |
| | | failedServers = [] |
| | | failingServerList = '' |
| | | referenceServerPath = '%s/%s' % (referenceServer.getDir(), OPENDSNAME) |
| | | referenceSchema = '%s/config/schema/%s' % (referenceServerPath, schemaFile) |
| | | schemaDiffs = 'schemaDiffs.ldif' |
| | | </script> |
| | | |
| | | <message> |
| | | 'Verify schema file %s taking %s as reference.' % (schemaFile, referenceServerPath) |
| | | </message> |
| | | |
| | | <iterate var="server" in="serverList"> |
| | | <sequence> |
| | | <!-- Copy reference schema file to other server --> |
| | | <call function="'copyFile'"> |
| | | { 'location' : referenceServer.getHostname(), |
| | | 'remotehost' : server.getHostname(), |
| | | 'srcfile' : referenceSchema, |
| | | 'destfile' : '%s/reference_%s' % (server.getDir(), schemaFile) } |
| | | </call> |
| | | |
| | | <script> |
| | | serverPath = '%s/%s' % (server.getDir(), OPENDSNAME) |
| | | </script> |
| | | |
| | | <!-- Compare this schema to the reference one --> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { 'location' : location, |
| | | 'dsPath' : dsPath, |
| | | 'sourceLdif' : '%s/config/schema/%s' % (serverPath, schemaFile), |
| | | 'targetLdif' : '%s/reference_%s' % (server.getDir(), schemaFile), |
| | | 'outputLdif' : '%s/%s' % (server.getDir(), schemaDiffs) } |
| | | </call> |
| | | |
| | | <script> |
| | | if STAXResult != 0 : |
| | | failedServers.append('%s:%s' % (server.getHostname(), server.getPort())) |
| | | </script> |
| | | </sequence> |
| | | </iterate> |
| | | |
| | | <if expr="len(failedServers) > 0"> |
| | | <!-- If at least one server failed to successfully compare to the reference tree, |
| | | ! return an error, along with the list of the servers that failed to do so --> |
| | | <script> |
| | | myRC = 1 |
| | | comma = ',' |
| | | failingServerList = 'List of non-synchronized servers (schema verify FAILED): %s ' % comma.join(failedServers) |
| | | </script> |
| | | <else> |
| | | <script> |
| | | failingServerList = 'All servers synchronized (schema verify SUCCEEDED).' |
| | | </script> |
| | | </else> |
| | | </if> |
| | | |
| | | |
| | | <call function="'checktestRC'"> |
| | | { 'returncode' : myRC, |
| | | 'result' : failingServerList , |
| | | 'expected' : 0 } |
| | | </call> |
| | | |
| | | <return> [myRC, failedServers] </return> |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | <function name="deleteTrees"> |
| | | <function-prolog> |
| | | This function deletes a (sub)tree from a list of servers. |
| | | </function-prolog> |
| | | <function-list-args> |
| | | <function-arg-def name="serverList" type="required"> |
| | | <function-arg-description> |
| | | List of the servers (instances of "Server" class) where the tree will be deleted. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Server-list"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="treeSuffix" type="required"> |
| | | <function-arg-description> |
| | | Suffix of the tree to delete. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="startDS" type="optional" default="True"> |
| | | <function-arg-description> |
| | | Need to start the Directory Servers before deleting. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="boolean"/> |
| | | </function-arg-def> |
| | | </function-list-args> |
| | | |
| | | <sequence> |
| | | |
| | | <if expr="startDS"> |
| | | <!-- Start the servers in the list --> |
| | | <call function="'startServers'"> |
| | | [serverList] |
| | | </call> |
| | | </if> |
| | | |
| | | <!-- Delete the tree in every server in the list --> |
| | | <paralleliterate var="server" in="serverList"> |
| | | <sequence> |
| | | <message> |
| | | 'Delete suffix %s on server running on host %s on port %s' % (treeSuffix, server.getHostname(), server.getPort()) |
| | | </message> |
| | | |
| | | <!-- Delete suffix and subtree --> |
| | | <call function="'ldapDeleteWithScript'"> |
| | | { 'location' : server.getHostname(), |
| | | 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME), |
| | | 'dsInstanceHost' : server.getHostname(), |
| | | 'dsInstancePort' : server.getPort(), |
| | | 'dsInstanceDn' : server.getRootDn(), |
| | | 'dsInstancePswd' : server.getRootPwd(), |
| | | 'dsDn' : [treeSuffix], |
| | | 'dsDeleteSubtree' : True } |
| | | </call> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | <if expr="startDS"> |
| | | <!-- Stop the servers in the list --> |
| | | <call function="'stopServers'"> |
| | | [serverList] |
| | | </call> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | <function name="startServers"> |
| | | <function-prolog> |
| | | This function starts a list of servers. |
| | | </function-prolog> |
| | | <function-list-args> |
| | | <function-arg-def name="serverList" type="required"> |
| | | <function-arg-description> |
| | | List of the servers (instances of "Server" class) to be started. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Server-list"/> |
| | | </function-arg-def> |
| | | </function-list-args> |
| | | |
| | | <sequence> |
| | | <!-- Start the servers in the list --> |
| | | <paralleliterate var="server" in="serverList"> |
| | | <sequence> |
| | | <message> |
| | | 'Start DS on host %s to run on port %s' % (server.getHostname(),server.getPort()) |
| | | </message> |
| | | |
| | | <!--- Start DS --> |
| | | <call function="'StartDsWithScript'"> |
| | | { 'location' : server.getHostname(), |
| | | 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME) } |
| | | </call> |
| | | |
| | | <!--- Check that DS started --> |
| | | <call function="'isAlive'"> |
| | | { 'location' : server.getHostname(), |
| | | 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME), |
| | | 'dsInstanceHost' : server.getHostname(), |
| | | 'dsInstancePort' : server.getPort(), |
| | | 'dsInstanceDn' : server.getRootDn(), |
| | | 'dsInstancePswd' : server.getRootPwd(), |
| | | 'noOfLoops' : 5 , |
| | | 'noOfMilliSeconds' : 2000 } |
| | | </call> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | <function name="stopServers"> |
| | | <function-prolog> |
| | | This function stops a list of servers. |
| | | </function-prolog> |
| | | <function-list-args> |
| | | <function-arg-def name="serverList" type="required"> |
| | | <function-arg-description> |
| | | List of the servers (instances of "Server" class) to be stopped. |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Server-list"/> |
| | | </function-arg-def> |
| | | </function-list-args> |
| | | |
| | | <sequence> |
| | | <!-- Stop the servers in the list --> |
| | | <paralleliterate var="server" in="serverList"> |
| | | <sequence> |
| | | <message> |
| | | 'Stop DS on host %s running on port %s' % (server.getHostname(),server.getPort()) |
| | | </message> |
| | | |
| | | <!--- Stop DS --> |
| | | <call function="'StopDsWithScript'"> |
| | | { 'location' : server.getHostname(), |
| | | 'dsHost' : server.getHostname(), |
| | | 'dsPath' : '%s/%s' % (server.getDir(),OPENDSNAME), |
| | | 'dsPort' : server.getPort(), |
| | | 'dsBindDN' : server.getRootDn(), |
| | | 'dsBindPwd' : server.getRootPwd() } |
| | | </call> |
| | | </sequence> |
| | | </paralleliterate> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | <function name="CLI_rebuild-index"> |
| | | <function-prolog> |
| | | This wraps the rebuild-index tool to make it easy to use from STAX |