<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<!DOCTYPE stax SYSTEM "../stax.dtd">
|
<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
! Copyright 2007-2008 Sun Microsystems, Inc.
|
! -->
|
<stax>
|
|
<function name="_adminCommonArgs">
|
<function-prolog>
|
This function resolves common admin arguments
|
</function-prolog>
|
<function-no-args/>
|
|
<script>
|
if dsInstanceHost:
|
STAFCmdParamsList.append('-h %s' % dsInstanceHost)
|
|
if dsInstanceAdminPort:
|
STAFCmdParamsList.append('-p %s' % dsInstanceAdminPort)
|
STAFCmdParamsList.append('-X')
|
|
if dsInstanceDn:
|
STAFCmdParamsList.append('-D "%s"' % dsInstanceDn)
|
|
if dsInstancePswd:
|
STAFCmdParamsList.append('-w "%s"' % dsInstancePswd)
|
|
</script>
|
|
</function>
|
|
<!-- This function sets up DS using the setup script -->
|
<function name="SetUpDsWithScript">
|
<function-prolog>
|
This function sets up a Directory Server using a script
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="dsPort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsAdminPort"
|
type="optional"
|
default="DIRECTORY_INSTANCE_ADMIN_PORT">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsJmxPort" type="optional">
|
<function-arg-description>
|
Directory server JMX port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsBaseDN" type="optional">
|
<function-arg-description>
|
Base DN (only single base DN supported).
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindDN" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPwd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPwdFile" type="optional">
|
<function-arg-description>
|
Bind password file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsEnableWindowsService" type="optional">
|
<function-arg-description>
|
Enable as a Windows Service
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="dsDoNotStart" type="optional">
|
<function-arg-description>
|
Do not start server after setup
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Help option
|
</function-arg-description>
|
<function-arg-property name="help" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
STAFCmd='%s/setup%s' % (dsPath,fileExt)
|
STAFCmdParamsList.append('--cli')
|
STAFCmdParamsList.append('-n')
|
|
if dsPort:
|
STAFCmdParamsList.append('-p %s' % dsPort)
|
|
if dsAdminPort:
|
STAFCmdParamsList.append('--adminConnectorPort %s' % dsAdminPort)
|
|
if dsJmxPort:
|
STAFCmdParamsList.append('-x %s' % dsJmxPort)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsBindDN:
|
STAFCmdParamsList.append('-D "%s"' % dsBindDN)
|
|
if dsBindPwd:
|
STAFCmdParamsList.append('-w "%s"' % dsBindPwd)
|
|
if dsBindPwdFile:
|
STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
|
|
if dsEnableWindowsService:
|
STAFCmdParamsList.append('-e')
|
|
if dsDoNotStart:
|
STAFCmdParamsList.append('-O')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Setup DS Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'path' : dsPath,
|
'expectedRC': 'noCheck',
|
'knownIssue': knownIssue
|
}
|
</call>
|
</sequence>
|
</function>
|
|
<!-- This function starts DS using the start-ds script -->
|
<function name="StartDsWithScript">
|
<function-prolog>
|
This function starts a Directory Server
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Directory server version
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsSystemInfo" type="optional">
|
<function-arg-description>
|
Directory server system info
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsNoDetach" type="optional">
|
<function-arg-description>
|
Do not detach directory server from process
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Help option
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsBuildInfo" type="optional">
|
<function-arg-description>
|
Directory server build information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/start-ds%s' % (dsBinPath,fileExt)
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
if dsSystemInfo:
|
STAFCmdParamsList.append('-s')
|
|
if dsNoDetach:
|
STAFCmdParamsList.append('-N')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsBuildInfo:
|
STAFCmdParamsList.append('-F')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>STAXResult</return>
|
|
</sequence>
|
|
</function>
|
|
<!-- This function stops DS using the stop-ds script -->
|
<function name="StopDsWithScript">
|
<function-prolog>
|
This function starts a Directory Server using the script
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsAdminPort" type="optional">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsUseSSL" type="optional">
|
<function-arg-description>
|
Use SSL for secure communication with the server
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsUseStartTLS" type="optional">
|
<function-arg-description>
|
Use StartTLS for secure communication with the server
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindDN" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPwd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPwdFile" type="optional">
|
<function-arg-description>
|
Bind password file
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
<function-arg-def name="dsSaslOption" type="optional">
|
<function-arg-description>
|
SASL bind options
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsProxyAuthZID" type="optional">
|
<function-arg-description>
|
Use the proxied authorization control with the given authorization ID
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsStopReason" type="optional">
|
<function-arg-description>
|
Reason the server is being stopped or restarted
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsRestart" type="optional">
|
<function-arg-description>
|
Attempt to automatically restart the server once it has stopped
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsStopTime" type="optional">
|
<function-arg-description>
|
Time to begin the shutdown in YYYYMMDDhhmmss format (local time)
|
</function-arg-description>
|
<function-arg-property name="type" value="timestamp"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustAll" type="optional">
|
<function-arg-description>
|
Trust all server SSL certificates
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStoreFile" type="optional">
|
<function-arg-description>
|
Certificate keystore path
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStorePwd" type="optional">
|
<function-arg-description>
|
Certificate keystore PIN
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStorePwdFile" type="optional">
|
<function-arg-description>
|
Certificate keystore PIN file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStoreFile" type="optional">
|
<function-arg-description>
|
Certificate trust store path
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStorePwd" type="optional">
|
<function-arg-description>
|
Certificate trust store PIN
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStorePwdFile" type="optional">
|
<function-arg-description>
|
Certificate trust store PIN file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Help option
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/stop-ds%s' % (dsBinPath,fileExt)
|
|
if dsHost:
|
STAFCmdParamsList.append('-h %s' % dsHost)
|
|
if dsAdminPort:
|
STAFCmdParamsList.append('-p %s' % dsAdminPort)
|
STAFCmdParamsList.append('-X')
|
|
if dsUseSSL:
|
STAFCmdParamsList.append('-Z')
|
|
if dsUseStartTLS:
|
STAFCmdParamsList.append('-q')
|
|
if dsBindDN:
|
STAFCmdParamsList.append('-D "%s"' % dsBindDN)
|
|
if dsBindPwd:
|
STAFCmdParamsList.append('-w "%s"' % dsBindPwd)
|
|
if dsBindPwdFile:
|
STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
|
|
if dsSaslOption:
|
STAFCmdParamsList.append('-o "%s"' % dsSaslOption)
|
|
if dsProxyAuthZID:
|
STAFCmdParamsList.append('-Y "%s"' % dsProxyAuthZID)
|
|
if dsStopReason:
|
STAFCmdParamsList.append('-r "%s"' % dsStopReason)
|
|
if dsRestart:
|
STAFCmdParamsList.append('-R')
|
|
if dsStopTime:
|
STAFCmdParamsList.append('-t "%s"' % dsStopTime)
|
|
if dsKeyStoreFile:
|
STAFCmdParamsList.append('-K "%s"' % dsKeyStoreFile)
|
|
if dsKeyStorePwd:
|
STAFCmdParamsList.append('-W "%s"' % dsKeyStorePwd)
|
|
if dsKeyStorePwdFile:
|
STAFCmdParamsList.append('-u "%s"' % dsKeyStorePwdFile)
|
|
if dsTrustStoreFile:
|
STAFCmdParamsList.append('-P "%s"' % dsTrustStoreFile)
|
|
if dsTrustStorePwd:
|
STAFCmdParamsList.append('-T "%s"' % dsTrustStorePwd)
|
|
if dsTrustStorePwdFile:
|
STAFCmdParamsList.append('-U "%s"' % dsTrustStorePwdFile)
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Stop DS Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<call function="'Sleep'">
|
{ 'sleepForMilliSeconds' : 3000 }
|
</call>
|
</sequence>
|
</function>
|
|
<!-- Import LDIF file Function -->
|
<function name="importLdif">
|
<function-prolog>
|
This function performs an offline import of an ldif file
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="ldifFile" type="required">
|
<function-arg-description>
|
Path to the LDIF file to be imported
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
Backend ID for the backend to import
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="extraParams" type="optional" default="''">
|
<function-arg-description>
|
Optional extra parameters for specific test cases
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
</script>
|
|
<message>
|
'%s/import-ldif%s -l %s -n %s %s' % (dsBinPath,fileExt,ldifFile,backEnd,extraParams)
|
</message>
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Offline Import',
|
'command' : '%s/import-ldif%s' % (dsBinPath,fileExt),
|
'arguments' : '-l %s -n %s %s' % (ldifFile,backEnd,extraParams),
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>RC</return>
|
</sequence>
|
</function>
|
|
<!-- Import Function With Script-->
|
<function name="ImportLdifWithScript">
|
<function-prolog>
|
This function performs an offline import of an ldif file using the script
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceAdminPort" type="optional">
|
<function-arg-description>
|
Directory server adminport number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsLdifFile" type="required">
|
<function-arg-description>
|
Path to the LDIF file to be imported
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsTemplateFile" type="optional">
|
<function-arg-description>
|
Path to a MakeLDIF template to use to generate the import data
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsAppend" type="optional">
|
<function-arg-description>
|
Append to an existing database rather than overwriting it
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsReplaceExisting" type="optional">
|
<function-arg-description>
|
Replace existing entries when appending to the database
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsBackEnd" type="optional">
|
<function-arg-description>
|
Backend ID for the backend to import
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsBranchDN" type="optional">
|
<function-arg-description>
|
Base DN of a branch to include in the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsIncludeBranch" type="optional">
|
<function-arg-description>
|
Base DN of a branch to include in the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsExcludeBranch" type="optional">
|
<function-arg-description>
|
Base DN of a branch to exclude from the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsIncludeAttribute" type="optional">
|
<function-arg-description>
|
Attribute to include in the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="attribute"/>
|
</function-arg-def>
|
<function-arg-def name="dsExcludeAttribute" type="optional">
|
<function-arg-description>
|
Attribute to exclude in the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="attribute"/>
|
</function-arg-def>
|
<function-arg-def name="dsIncludeFilter" type="optional">
|
<function-arg-description>
|
Filter to identify entries to include in the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="filter"/>
|
</function-arg-def>
|
<function-arg-def name="dsExcludeFilter" type="optional">
|
<function-arg-description>
|
Filter to identify entries to exclude from the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="filter"/>
|
</function-arg-def>
|
<function-arg-def name="dsRejectFile" type="optional">
|
<function-arg-description>
|
Write rejected entries to the specified file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsOverWriteRejects" type="optional">
|
<function-arg-description>
|
Overwrite an existing rejects file rather than appending to it
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsRandomSeed" type="optional">
|
<function-arg-description>
|
Seed for the MakeLDIF random number generator
|
</function-arg-description>
|
<function-arg-property name="type" value="seed"/>
|
</function-arg-def>
|
<function-arg-def name="dsSkipSchemaValidation" type="optional">
|
<function-arg-description>
|
Skip schema validation during the LDIF import
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsIsCompressed" type="optional">
|
<function-arg-description>
|
LDIF file is compressed
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsIsEncrypted" type="optional">
|
<function-arg-description>
|
LDIF file is encrypted
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsQuiet" type="optional">
|
<function-arg-description>
|
Use quiet mode (no output)
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="startTask" type="optional">
|
<function-arg-description>
|
Start time for task
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
</script>
|
|
<!-- Set common ldap arguments -->
|
<call function="'_adminCommonArgs'" />
|
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/import-ldif%s' % (dsBinPath,fileExt)
|
|
if dsLdifFile:
|
STAFCmdParamsList.append('-l %s' % dsLdifFile)
|
|
if dsTemplateFile:
|
STAFCmdParamsList.append('-A %s' % dsTemplateFile)
|
|
if dsAppend:
|
STAFCmdParamsList.append('-a')
|
|
if dsReplaceExisting:
|
STAFCmdParamsList.append('-r')
|
|
if dsIncludeBranch:
|
for InBranch in dsIncludeBranch:
|
STAFCmdParamsList.append('-b %s ' % InBranch)
|
|
if dsExcludeBranch:
|
for ExBranch in dsExcludeBranch:
|
STAFCmdParamsList.append('-B %s ' % ExBranch)
|
|
if dsIncludeAttribute:
|
for InAttr in dsIncludeAttribute:
|
STAFCmdParamsList.append('-i %s ' % InAttr)
|
|
if dsExcludeAttribute:
|
for ExAttr in dsExcludeAttribute:
|
STAFCmdParamsList.append('-e %s ' % ExAttr)
|
|
if dsIncludeFilter:
|
for InFilter in dsIncludeFilter:
|
STAFCmdParamsList.append('-I "%s" ' % InFilter)
|
|
if dsExcludeFilter:
|
for ExFilter in dsExcludeFilter:
|
STAFCmdParamsList.append('-E "%s" ' % ExFilter)
|
|
if dsRejectFile:
|
STAFCmdParamsList.append('-R %s' % dsRejectFile)
|
|
if dsOverWriteRejects:
|
STAFCmdParamsList.append('-O')
|
|
if dsRandomSeed:
|
STAFCmdParamsList.append('-s %s' % dsRandomSeed)
|
|
if dsSkipSchemaValidation:
|
STAFCmdParamsList.append('-S')
|
|
if dsIsCompressed:
|
STAFCmdParamsList.append('-c')
|
|
if dsIsEncrypted:
|
STAFCmdParamsList.append('-y')
|
|
if dsQuiet:
|
STAFCmdParamsList.append('-q')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsBackEnd:
|
STAFCmdParamsList.append('-n %s' % dsBackEnd)
|
|
if startTask:
|
STAFCmdParamsList.append('-t %s' % startTask)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
</script>
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Offline Import Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
</sequence>
|
</function>
|
|
|
<!-- Import Task Function -->
|
<function name="importLdifTask">
|
<function-prolog>
|
This function performs an on line import task of an ldif file
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="ldifFile" type="optional">
|
<function-arg-description>
|
The name of the ldif file
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
Optional the name of the database backend
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="isCompressed" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional imported ldif data file compressed
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="isEncrypted" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional imported ldif data file encrypted
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="rejectsFile" type="optional">
|
<function-arg-description>
|
Optional name of rejects file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="overwriteRejectsFile" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional name of rejects file
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="append" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional append imported ldif data
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="skipSchemaValidation" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional don't do schema validation on import
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="replaceExisting" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional replace existing data
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="excludeBranches" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude branches
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeBranches" type="optional" default="''">
|
<function-arg-description>
|
Optional include branches
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="excludeAttributes" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude attributes
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeAttributes" type="optional" default="''">
|
<function-arg-description>
|
Optional include attributes
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="excludeFilters" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude filters
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeFilters" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude filters
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="numLdapCheckTries" type="optional" default="10">
|
<function-arg-description>
|
Number of ldap check tries when checking if task is complete
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="sleepBetweenLdapCheckTries" type="optional" default="2000">
|
<function-arg-description>
|
Sleep time in milliseconds between ldap check tries
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='import-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the import task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-import')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.ImportTask')
|
|
ldifLines.append('ds-task-import-backend-id: %s' % backEnd )
|
ldifLines.append('ds-task-import-ldif-file: %s' % ldifFile )
|
ldifLines.append('ds-task-import-is-compressed: %s' % isCompressed )
|
ldifLines.append('ds-task-import-is-encrypted: %s' % isEncrypted )
|
|
if rejectsFile:
|
ldifLines.append('ds-task-import-reject-file: %s' % rejectsFile )
|
|
ldifLines.append('ds-task-import-overwrite-rejects: %s' % overwriteRejectsFile )
|
ldifLines.append('ds-task-import-append: %s' % append )
|
ldifLines.append('ds-task-import-skip-schema-validation: %s' % skipSchemaValidation )
|
ldifLines.append('ds-task-import-replace-existing: %s' % replaceExisting )
|
</script>
|
|
<script>
|
for branch in excludeBranches:
|
ldifLines.append('ds-task-import-exclude-branch: %s' % branch )
|
|
for branch in includeBranches:
|
ldifLines.append('ds-task-import-include-branch: %s' % branch )
|
|
for attribute in excludeAttributes:
|
ldifLines.append('ds-task-import-exclude-attribute: %s' % attribute )
|
|
for attribute in includeAttributes:
|
ldifLines.append('ds-task-import-include-attribute: %s' % attribute )
|
|
for filter in excludeFilters:
|
ldifLines.append('ds-task-import-exclude-filter: %s' % filter)
|
|
for filter in includeFilters:
|
ldifLines.append('ds-task-import-include-filter: %s' % filter)
|
</script>
|
|
<!-- Write out the import-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the import-task ldif to remote host -->
|
<message>'Copy import task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Import Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<!-- Check that the ldap task is completed -->
|
<if expr="STAFCmdRC == 0">
|
<sequence>
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'noOfLoops' : numLdapCheckTries,
|
'sleepMilliSeconds' : sleepBetweenLdapCheckTries }
|
</call>
|
<message>'Check CheckLdapTask returns RC=0'</message>
|
<call function="'checktestRC'">
|
{ 'returncode' : RC ,
|
'result' : STAXResult }
|
</call>
|
</sequence>
|
</if>
|
|
</sequence>
|
|
</function>
|
|
<!-- Check Import Function -->
|
<function name="checkImport">
|
<function-prolog>
|
This function verifies an import of an ldif file
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsHost"
|
type="optional"
|
default="DIRECTORY_INSTANCE_HOST">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsPort"
|
type="optional"
|
default="DIRECTORY_INSTANCE_PORT">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsAdminPort"
|
type="optional"
|
default="DIRECTORY_INSTANCE_ADMIN_PORT">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsDn"
|
type="optional"
|
default="DIRECTORY_INSTANCE_DN">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsPswd"
|
type="optional"
|
default="DIRECTORY_INSTANCE_PSWD">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedEntries" type="required">
|
<function-arg-description>
|
Entries expected to be present after import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="missingEntries"
|
type="optional"
|
default="'NULL'">
|
<function-arg-description>
|
Optional entries expected to be missing after import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="expectedAttributes"
|
type="optional"
|
default="'NULL'">
|
<function-arg-description>
|
Optional attributes expected to be present after import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="missingAttributes"
|
type="optional"
|
default="'NULL'">
|
<function-arg-description>
|
Optional attributes expected to be missing after import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="suffix"
|
type="optional"
|
default="DIRECTORY_INSTANCE_SFX">
|
<function-arg-description>
|
Optional main suffix for the import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="startDS" type="optional" default="'yes'">
|
<function-arg-description>
|
Optional start the Directory Server after import
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
myPath=dsPath
|
myhost=dsHost
|
myport=dsPort
|
myadminport=dsAdminPort
|
mydn=dsDn
|
mypswd=dsPswd
|
</script>
|
|
<!-- Assume that if DS is not started then there is no need to stop it -->
|
<script>
|
if startDS == 'yes':
|
stopDS='yes'
|
else:
|
stopDS='no'
|
</script>
|
|
<!-- Do we need to start the DS -->
|
<if expr="startDS == 'yes'">
|
<sequence>
|
<!-- StartDS -->
|
<call function="'StartDsWithScript'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath }
|
</call>
|
|
<!-- Wait for DS to start -->
|
<call function="'isAlive'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsInstanceHost' : myhost ,
|
'dsInstancePort' : myport ,
|
'dsInstanceDn' : mydn ,
|
'dsInstancePswd' : mypswd ,
|
'noOfLoops' : 10 ,
|
'noOfMilliSeconds' : 2000 }
|
</call>
|
|
</sequence>
|
</if>
|
|
<!-- Search for expected entries -->
|
<iterate var="expectedEntry" in="expectedEntries">
|
<sequence>
|
<call function="'SearchObject'">
|
{ 'location' : myLocation ,
|
'dsPath' : myPath,
|
'dsInstanceHost' : myhost ,
|
'dsInstancePort' : myport ,
|
'dsInstanceDn' : mydn ,
|
'dsInstancePswd' : mypswd ,
|
'dsBaseDN' : '%s' % expectedEntry ,
|
'dsFilter' : 'objectclass=*'
|
}
|
</call>
|
<call function="'checktestRC'">
|
{ 'returncode' : RC ,
|
'result' : STAXResult }
|
</call>
|
</sequence>
|
</iterate>
|
|
<!-- Search for missing entries -->
|
<iterate var="missingEntry" in="missingEntries">
|
<sequence>
|
<if expr="missingEntry == 'NULL'">
|
<break/>
|
</if>
|
<call function="'SearchObject'">
|
{ 'location' : myLocation ,
|
'dsPath' : myPath,
|
'dsInstanceHost' : myhost ,
|
'dsInstancePort' : myport ,
|
'dsInstanceDn' : mydn ,
|
'dsInstancePswd' : mypswd ,
|
'dsBaseDN' : '%s' % missingEntry ,
|
'dsFilter' : 'objectclass=*' ,
|
'expectedRC' : 32
|
}
|
</call>
|
</sequence>
|
</iterate>
|
|
<!-- Do we need to stop the Directory Server -->
|
<if expr="stopDS == 'yes'">
|
<!-- StopDS -->
|
<call function="'StopDsWithScript'">
|
{ 'location' : myLocation ,
|
'dsPath' : myPath,
|
'dsHost' : myhost ,
|
'dsAdminPort' : myadminport ,
|
'dsBindDN' : mydn ,
|
'dsBindPwd' : mypswd }
|
</call>
|
</if>
|
</sequence>
|
</function>
|
|
<function name="exportLdif">
|
<function-prolog>
|
This function performs an export to an ldif file on or off line
|
</function-prolog>
|
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceAdminPort" type="optional">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="ldifFile" type="required">
|
<function-arg-description>
|
The name of the ldif file to be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
The name of the database backend
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="extraParams" type="optional" default="''">
|
<function-arg-description>
|
Optional extra parameters for specific test cases
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="startTask" type="optional">
|
<function-arg-description>
|
Start time for task
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
</script>
|
|
<!-- Set common ldap arguments -->
|
<call function="'_adminCommonArgs'" />
|
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/export-ldif%s' % (dsBinPath,fileExt)
|
|
if ldifFile:
|
STAFCmdParamsList.append('-l %s' % ldifFile)
|
|
if backEnd:
|
STAFCmdParamsList.append('-n %s' % backEnd)
|
|
if extraParams:
|
STAFCmdParamsList.append('%s' % extraParams)
|
|
if startTask:
|
STAFCmdParamsList.append('-t %s' % startTask)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
</script>
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Export Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>
|
STAXResult
|
</return>
|
</sequence>
|
</function>
|
|
|
|
|
<!-- Export Task Function -->
|
<function name="exportLdifTask">
|
<function-prolog>
|
This function performs an on line export task of an ldif file
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="ldifFile" type="optional">
|
<function-arg-description>
|
The name of the ldif file
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
Optional the name of the database backend
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="isCompressed" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional exported ldif data file compressed
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="isEncrypted" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional exported ldif data file encrypted
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="append" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional append exported ldif data
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="excludeBranches" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude branches
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeBranches" type="optional" default="''">
|
<function-arg-description>
|
Optional include branches
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="excludeAttributes" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude attributes
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeAttributes" type="optional" default="''">
|
<function-arg-description>
|
Optional include attributes
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="excludeFilters" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude filters
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="includeFilters" type="optional" default="''">
|
<function-arg-description>
|
Optional exclude filters
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="isSignedHash" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional generate a signed hash of the export data
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='export-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the export task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-export')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.ExportTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
|
ldifLines.append('ds-task-export-backend-id: %s' % backEnd )
|
ldifLines.append('ds-task-export-ldif-file: %s' % ldifFile )
|
ldifLines.append('ds-task-export-compress-ldif: %s' % isCompressed )
|
ldifLines.append('ds-task-export-encrypt-ldif: %s' % isEncrypted )
|
ldifLines.append('ds-task-export-sign-hash: %s' % isSignedHash )
|
</script>
|
|
<script>
|
for branch in excludeBranches:
|
ldifLines.append('ds-task-export-exclude-branch: %s' % branch )
|
|
for branch in includeBranches:
|
ldifLines.append('ds-task-export-include-branch: %s' % branch )
|
|
for attribute in excludeAttributes:
|
ldifLines.append('ds-task-export-exclude-attribute: %s' % attribute )
|
|
for attribute in includeAttributes:
|
ldifLines.append('ds-task-export-include-attribute: %s' % attribute )
|
|
for filter in excludeFilters:
|
ldifLines.append('ds-task-export-exclude-filter: %s' % filter)
|
|
for filter in includeFilters:
|
ldifLines.append('ds-task-export-include-filter: %s' % filter)
|
</script>
|
|
<!-- Write out the export-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the export-task ldif to remote host -->
|
<message>'Copy export task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Export Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<!-- Check that the task is completed -->
|
<if expr="STAFCmdRC == 0">
|
<sequence>
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
<message>'Check CheckLdapTask returns RC=0'</message>
|
<call function="'checktestRC'">
|
{ 'returncode' : RC ,
|
'result' : STAXResult }
|
</call>
|
</sequence>
|
</if>
|
</sequence>
|
</function>
|
|
|
|
<!-- Backup Function -->
|
<function name="backup">
|
<function-prolog>
|
This function performs an off line backup
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceAdminPort" type="optional">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
Optional the name of the database backend
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupDir" type="required">
|
<function-arg-description>
|
The directory where the backup files will be placed
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="extraParams" type="optional" default="''">
|
<function-arg-description>
|
Optional extra parameters for specific test cases
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="startTask" type="optional">
|
<function-arg-description>
|
Start time for task
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
</script>
|
|
<!-- Set common ldap arguments -->
|
<call function="'_adminCommonArgs'" />
|
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/backup%s' % (dsBinPath,fileExt)
|
|
if backupDir:
|
STAFCmdParamsList.append('-d %s' % backupDir)
|
|
if backEnd:
|
STAFCmdParamsList.append('-n %s' % backEnd)
|
|
if extraParams:
|
STAFCmdParamsList.append('%s' % extraParams)
|
|
if startTask:
|
STAFCmdParamsList.append('-t %s' % startTask)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
</script>
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Backup Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
</sequence>
|
</function>
|
|
<!-- Backup Task Function -->
|
<function name="backupTask">
|
<function-prolog>
|
This function performs an on line backup task
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupDir" type="required">
|
<function-arg-description>
|
Path to the target directory for the backup file(s)
|
</function-arg-description>
|
<function-arg-property name="type" value="filepath"/>
|
</function-arg-def>
|
<function-arg-def name="backEnd" type="optional" default="DIRECTORY_INSTANCE_BE">
|
<function-arg-description>
|
Optional the name of the database backend
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupAll" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional back up all backends in the server
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="backupIncremental" type="optional">
|
<function-arg-description>
|
Optional perform an incremental backup rather than a full backup
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupIncrementalId" type="optional">
|
<function-arg-description>
|
Optional use the provided identifier for the backup
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="Compress" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional backup contents compressed
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="Encrypt" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional backup contents encrypted
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="signHash" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional generate a signed hash of the backup data
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="hash" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional generate a hash of the backup data
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='backup-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the backup task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-backup')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.BackupTask')
|
ldifLines.append('ds-backup-id: %s' % taskID)
|
|
ldifLines.append('ds-task-backup-backend-id: %s' % backEnd )
|
ldifLines.append('ds-backup-directory-path: %s' % backupDir )
|
ldifLines.append('ds-task-backup-all: %s' % backupAll )
|
ldifLines.append('ds-task-backup-compress: %s' % Compress )
|
ldifLines.append('ds-task-backup-encrypt: %s' % Encrypt )
|
ldifLines.append('ds-task-backup-sign-hash: %s' % signHash )
|
ldifLines.append('ds-task-backup-hash: %s' % hash )
|
|
if backupIncremental:
|
ldifLines.append('ds-task-backup-incremental: %s' % backupIncremental )
|
|
if backupIncrementalId:
|
ldifLines.append('ds-task-backup-incremental-base-id: %s' % backupIncrementalId )
|
</script>
|
|
<!-- Write out the backup-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the backup-task ldif to remote host -->
|
<message>'Copy backup task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Backup Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<!-- Check that the ldap task is completed -->
|
<if expr="STAFCmdRC == 0">
|
<sequence>
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
<message>'Check CheckLdapTask returns RC=0'</message>
|
<call function="'checktestRC'">
|
{ 'returncode' : RC ,
|
'result' : STAXResult }
|
</call>
|
</sequence>
|
</if>
|
</sequence>
|
|
</function>
|
|
|
<!-- Restore Function -->
|
<function name="restore">
|
<function-prolog>
|
This function performs an off line restore
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceAdminPort" type="optional">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupDir" type="required">
|
<function-arg-description>
|
The directory where the backup files will be placed
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="extraParams" type="optional" default="''">
|
<function-arg-description>
|
Optional extra parameters for specific test cases
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="startTask" type="optional">
|
<function-arg-description>
|
Start time for task
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
</script>
|
|
<!-- Set common ldap arguments -->
|
<call function="'_adminCommonArgs'" />
|
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/restore%s' % (dsBinPath,fileExt)
|
|
if backupDir:
|
STAFCmdParamsList.append('-d %s' % backupDir)
|
|
if extraParams:
|
STAFCmdParamsList.append('%s' % extraParams)
|
|
if startTask:
|
STAFCmdParamsList.append('-t %s' % startTask)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
</script>
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Restore Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
</sequence>
|
</function>
|
|
<!-- Restore Task Function -->
|
<function name="restoreTask">
|
<function-prolog>
|
This function performs an on line restore task of a backup file
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="backupDir" type="required">
|
<function-arg-description>
|
The name of the backup directory
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="backupId" type="optional">
|
<function-arg-description>
|
Optional the name of the backupId
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="verify" type="optional" default="'FALSE'">
|
<function-arg-description>
|
Optional verify the contents of the backup but do not restore it
|
</function-arg-description>
|
<function-arg-property name="type" value="boolean"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='restore-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the restore task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-restore')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.RestoreTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
|
ldifLines.append('ds-backup-directory-path: %s' % backupDir )
|
ldifLines.append('ds-task-restore-verify-only: %s' % verify )
|
|
if backupId:
|
ldifLines.append('ds-backup-id: %s' % backupId )
|
</script>
|
|
<!-- Write out the restore-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the restore-task ldif to remote host -->
|
<message>'Copy restore task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Restore Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<!-- Check that the ldap task is completed -->
|
<if expr="STAFCmdRC == 0">
|
<sequence>
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
<message>'Check CheckLdapTask returns RC=0'</message>
|
<call function="'checktestRC'">
|
{ 'returncode' : RC ,
|
'result' : STAXResult }
|
</call>
|
</sequence>
|
</if>
|
</sequence>
|
|
</function>
|
|
<!-- Shutdown Task Function -->
|
<function name="shutdownTask">
|
<function-prolog>
|
This function performs an on line export task for shutdown of the directory
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='shutdown-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
|
<!-- Build the shutdown task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-shutdown')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.ShutdownTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
</script>
|
|
<!-- Write out the shutdown-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the shutdown-task ldif to remote host -->
|
<message>'Copy shutdown task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Export Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<return>STAFCmdRC</return>
|
|
</sequence>
|
</function>
|
|
<!-- Restart Task Function -->
|
<function name="restartTask">
|
<function-prolog>
|
This function performs an on line export task for restart of the directory
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='restart-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the restart task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-shutdown')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.ShutdownTask')
|
ldifLines.append('ds-task-restart-server: true')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
</script>
|
|
<!-- Write out the restart-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the restart-task ldif to remote host -->
|
<message>'Copy restart task ldif (%s) to %s' % (tmpTaskLdif,taskLdif)</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Export Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif,
|
'expectedRC' : expectedRC }
|
</call>
|
|
<script>
|
STAFCmdRC=STAXResult[0]
|
</script>
|
|
<!--- Check that DS started -->
|
<if expr="STAFCmdRC == 0">
|
<sequence>
|
<call function="'isAlive'">
|
{ 'noOfLoops' : 10 ,
|
'noOfMilliSeconds' : 2000 }
|
</call>
|
</sequence>
|
</if>
|
|
<return>STAFCmdRC</return>
|
|
</sequence>
|
</function>
|
|
<!-- Add Schema Task Function -->
|
<function name="addSchemaTask">
|
|
<function-prolog>
|
This function performs a dynamic schema add task
|
</function-prolog>
|
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="ldifFile" type="required">
|
<function-arg-description>
|
The name of the ldif file that contains the schema updates
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='schema-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the schema task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-add-schema-file')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.AddSchemaFileTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
|
ldifLines.append('ds-task-schema-file-name: %s' % ldifFile )
|
</script>
|
|
|
<!-- Write out the schema-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the schema-task ldif to remote host -->
|
<message>'Copy schema task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Copy the schema update ldif to remote host's config/schema directory -->
|
<message>'Copy schema update ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : myLocation,
|
'srcfile' : '%s/schema/ldifs/%s' % (remote.data,ldifFile),
|
'destfile' : '%s/%s/config/schema/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME,ldifFile),
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Schema Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif }
|
</call>
|
|
<!-- Check that the ldap task is completed -->
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
|
</sequence>
|
</function>
|
|
<!-- Add Leave Lockdown Task Function -->
|
<function name="leaveLockdownTask">
|
|
<function-prolog>
|
This function performs a leave lockdown task
|
</function-prolog>
|
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='leaveShutdownTask-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the schema task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.LeaveLockdownModeTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
</script>
|
|
|
<!-- Write out the task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the task ldif to remote host -->
|
<message>'Copy task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<!-- Copy the schema update ldif to remote host's config/schema directory -->
|
<!--
|
<message>'Copy update ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : myLocation,
|
'srcfile' : '%s/schema/ldifs/%s' % (remote.data,ldifFile),
|
'destfile' : '%s/%s/config/schema/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME,ldifFile),
|
'remotehost' : myLocation }
|
</call>
|
-->
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Schema Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif }
|
</call>
|
|
<!-- Check that the ldap task is completed -->
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
|
</sequence>
|
</function>
|
|
<!-- Total Update Task Function -->
|
<function name="TotalUpdateTask">
|
|
<function-prolog>
|
This function performs a total update of a replication domain
|
</function-prolog>
|
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="domainDN" type="required">
|
<function-arg-description>
|
The dn of the domain to be replicated
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="replicaServerID" type="required">
|
<function-arg-description>
|
The id of the replica server
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='totalupdate-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the total update task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-initialize-from-remote-replica')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.InitializeTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
ldifLines.append('ds-task-initialize-domain-dn: %s' % domainDN)
|
ldifLines.append('ds-task-initialize-replica-server-id: %s' % replicaServerID)
|
</script>
|
|
<!-- Write out the totalupdate-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the totalupdate-task ldif to remote host -->
|
<message>'Copy totalupdate task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message level="'error'">
|
'Copy of totalupdate task failed (STAXCode=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Total Update Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif }
|
</call>
|
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message>
|
'Start of totalupdate task failed (Code=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
<!-- Check that the ldap task is completed -->
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd }
|
</call>
|
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message>
|
'Check of totalupdate task failed (Code=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
<script>
|
STAXCode=0
|
STAXReason='%s: Success' % STAXCurrentFunction
|
</script>
|
|
<return>[STAXCode, STAXReason]</return>
|
|
</sequence>
|
|
</function>
|
|
<function name="StartLdapTask">
|
<function-prolog>
|
This function starts a task using the ldap task interface
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Location of target host
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="taskLabel" type="required">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsPort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsTaskLdif" type="required">
|
<function-arg-description>
|
Ldif file for task
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
</script>
|
|
<!-- Build the Modify Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldapmodify%s' % (dsBinPath,fileExt)
|
|
STAFCmdParamsList.append('-a')
|
|
if dsHost:
|
STAFCmdParamsList.append('-h %s' % dsHost)
|
|
if dsPort:
|
STAFCmdParamsList.append('-p %s' % dsPort)
|
|
if dsBindDn:
|
STAFCmdParamsList.append('-D "%s"' % dsBindDn)
|
|
if dsBindPswd:
|
STAFCmdParamsList.append('-w "%s"' % dsBindPswd)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<!-- Perform Task with ldapmodify -->
|
<process name="taskLabel">
|
<location>'%s' % myLocation</location>
|
<command>'%s' % STAFCmd</command>
|
<parms>'%s' % STAFCmdParams</parms>
|
<workdir>'%s' % dsBinPath</workdir>
|
<envs>
|
['PATH=/bin:/usr/bin:%s' % dsBinPath, 'JAVA_HOME=%s' % JAVA_HOME]
|
</envs>
|
<stdin>'%s' % dsTaskLdif</stdin>
|
<stderr mode="'stdout'"/>
|
<returnstdout/>
|
</process>
|
|
<script>
|
STAFCmdRC=RC
|
STAFCmdResult=STAXResult
|
</script>
|
|
<call function="'checktestRC'">
|
{ 'returncode' : STAFCmdRC,
|
'result' : STAFCmdResult,
|
'expected' : expectedRC
|
}
|
</call>
|
|
<return>[STAFCmdRC, STAFCmdResult[0][1]]</return>
|
|
</sequence>
|
|
</function>
|
|
<function name="CheckLdapTask">
|
<function-prolog>
|
This function checks a task using the ldap task interface
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Location of target host
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsTaskDn" type="required">
|
<function-arg-description>
|
Dn of the task to be performed
|
</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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsPort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="noOfLoops" type="optional" default="10">
|
<function-arg-description>
|
Number of ldap check tries when checking if task is complete
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="sleepMilliSeconds" type="optional" default="2000">
|
<function-arg-description>
|
Sleep time in milliseconds between ldap check tries
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Local variables -->
|
<script>
|
myLocation=location
|
</script>
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/ldapsearch%s' % (dsBinPath,fileExt)
|
|
if dsHost:
|
STAFCmdParamsList.append('-h %s' % dsHost)
|
|
if dsPort:
|
STAFCmdParamsList.append('-p %s' % dsPort)
|
|
if dsBindDn:
|
STAFCmdParamsList.append('-D "%s"' % dsBindDn)
|
|
if dsBindPswd:
|
STAFCmdParamsList.append('-w "%s"' % dsBindPswd)
|
|
if dsTaskDn:
|
STAFCmdParamsList.append('-b "%s"' % dsTaskDn)
|
|
dsScope='base'
|
STAFCmdParamsList.append('-s %s' % dsScope)
|
|
dsFilter='"objectclass=*"'
|
STAFCmdParamsList.append('%s' % dsFilter)
|
|
dsAttribute='ds-task-state'
|
STAFCmdParamsList.append('%s' % dsAttribute)
|
|
dsAttribute='ds-task-log-message'
|
STAFCmdParamsList.append('%s' % dsAttribute)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<script>
|
successPattern = re.compile('ds-task-state: COMPLETED_SUCCESSFULLY')
|
stopErrPattern = re.compile('ds-task-state: STOPPED_BY_ERROR')
|
myCounter=1
|
</script>
|
|
<!-- Wait for the task to be COMPLETED_SUCCESSFULLY -->
|
<script>taskRC=1</script>
|
<loop from="1" to="noOfLoops" while="taskRC != 0">
|
<sequence>
|
|
<message>
|
'LOOP number %s - %s %s' % (myCounter, STAFCmd, STAFCmdParams)
|
</message>
|
|
<!-- Search for task status -->
|
|
<call function="'runCommand'">
|
{ 'name' : 'Search On line Import Task',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : myLocation,
|
'expectedRC' : 'noCheck'
|
}
|
</call>
|
|
<script>
|
STAFCmdRC=RC
|
STAFCmdResult=STAXResult
|
myCounter=myCounter+1
|
</script>
|
|
<if expr='re.search(successPattern, STAFCmdResult[0][1]) != None'>
|
<sequence>
|
<script>taskRC=0</script>
|
<message>
|
'%s' % STAFCmdResult
|
</message>
|
<return>[taskRC, STAFCmdResult[0][1]]</return>
|
</sequence>
|
<elseif expr='re.search(stopErrPattern, STAFCmdResult[0][1]) != None'>
|
<sequence>
|
<message level="'error'">
|
'%s' % STAFCmdResult
|
</message>
|
<return>[taskRC, STAFCmdResult[0][1]]</return>
|
</sequence>
|
</elseif>
|
<else>
|
<message level="'Warning'">
|
'%s' % STAFCmdResult
|
</message>
|
</else>
|
</if>
|
|
<message>
|
'Sleeping for %s ms' % sleepMilliSeconds
|
</message>
|
|
<call function="'Sleep'">
|
{ 'sleepForMilliSeconds' : sleepMilliSeconds }
|
</call>
|
|
</sequence>
|
</loop>
|
|
<return>[taskRC, STAFCmdResult[0][1]]</return>
|
|
</sequence>
|
|
</function>
|
|
<!-- This function shows server status using the status script -->
|
<function name="StatusWithScript">
|
<function-prolog>
|
This function shows server status using the status script
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="dsBindDN" type="optional" default="''">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPwd" type="optional" default="''">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional" default="''">
|
<function-arg-description>
|
Help option
|
</function-arg-description>
|
<function-arg-property name="help" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
STAFCmdParamsList.append('-n')
|
STAFCmdParamsList.append('-X')
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/status%s' % (dsBinPath,fileExt)
|
|
if dsBindDN:
|
STAFCmdParamsList.append('-D "%s"' % dsBindDN)
|
|
if dsBindPwd:
|
STAFCmdParamsList.append('-w "%s"' % dsBindPwd)
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Status Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'path' : dsPath,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
|
</sequence>
|
|
</function>
|
|
<!-- This function executes the base64 encode decode utility with script -->
|
<function name="Base64WithScript">
|
<function-prolog>
|
This function executes the base64 encode decode utility with script
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="subcommand" type="required">
|
<function-arg-description>
|
The subcommand for base64 (encode or decode)
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="rawData" type="optional" default="''">
|
<function-arg-description>
|
The raw data to be base64 encoded
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="rawDataFile" type="optional" default="''">
|
<function-arg-description>
|
The path to a file containing the raw data to be base64 encoded
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="toEncodedFile" type="optional" default="''">
|
<function-arg-description>
|
The path to a file to which the base64-encoded data should be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="encodedData" type="optional" default="''">
|
<function-arg-description>
|
The base64-encoded data to be decoded
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="encodedDataFile" type="optional" default="''">
|
<function-arg-description>
|
The path to a file containing the base64-encoded data to be decoded
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="toRawFile" type="optional" default="''">
|
<function-arg-description>
|
The path to a file to which the raw base64-decoded data should be written
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="toolHelp" type="optional" default="''">
|
<function-arg-description>
|
Help option
|
</function-arg-description>
|
<function-arg-property name="help" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/base64%s' % (dsBinPath,fileExt)
|
|
if subcommand:
|
STAFCmdParamsList.append(subcommand)
|
|
if rawData:
|
STAFCmdParamsList.append('-d "%s"' % rawData)
|
|
if rawDataFile:
|
STAFCmdParamsList.append('-f "%s"' % rawDataFile)
|
|
if toEncodedFile:
|
STAFCmdParamsList.append('-o "%s"' % toEncodedFile)
|
|
if encodedData:
|
STAFCmdParamsList.append('-d "%s"' % encodedData)
|
|
if encodedDataFile:
|
STAFCmdParamsList.append('-f "%s"' % encodedDataFile)
|
|
if toRawFile:
|
STAFCmdParamsList.append('-o "%s"' % toRawFile)
|
|
if toolHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'name' : 'Base 64 %s Script' % subcommand,
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'path' : dsPath,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
|
</sequence>
|
</function>
|
|
|
<!-- Rebuild index Task Function -->
|
<function name="rebuildIndexTask">
|
<function-prolog>
|
This function performs an on line rebuild index task
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
<function-arg-property name="type" value="pathname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server host name
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePort" type="optional">
|
<function-arg-description>
|
Directory server port number
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="taskID" type="optional">
|
<function-arg-description>
|
The identifier for the task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="baseDN" type="required">
|
<function-arg-description>
|
The base Dn for which the index will be rebuilt
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="attributes" type="required">
|
<function-arg-description>
|
List of the attributes to re-index: e.g. ['cn','l']
|
</function-arg-description>
|
<function-arg-property name="type" value="list"/>
|
</function-arg-def>
|
<function-arg-def name="maxThreads"
|
type="optional"
|
default="5">
|
<function-arg-description>
|
Number of threads that should be used for the rebuild operation
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<script>
|
myLocation=location
|
myPath=dsPath
|
|
try:
|
import hashlib
|
m = hashlib.md5()
|
except ImportError:
|
import md5
|
m = md5.new()
|
m.update(location)
|
m.update(dsPath)
|
taskLdifFile='rebuildIndex-task-%s.ldif' % m.hexdigest()
|
taskLdif='%s/%s' % (remote.temp,taskLdifFile)
|
tmpTaskLdif='%s/%s' % (local.temp,taskLdifFile)
|
taskDN='ds-task-id=%s,cn=Scheduled Tasks,cn=Tasks' % taskID
|
</script>
|
|
<!-- Build the rebuild-index task configuration object -->
|
<script>
|
ldifLines=[]
|
ldifLines.append('dn: %s' % taskDN)
|
ldifLines.append('objectclass: top')
|
ldifLines.append('objectclass: ds-task')
|
ldifLines.append('objectclass: ds-task-rebuild')
|
ldifLines.append('ds-task-class-name: org.opends.server.tasks.RebuildTask')
|
ldifLines.append('ds-task-id: %s' % taskID)
|
|
ldifLines.append('ds-task-rebuild-base-dn: %s' % baseDN )
|
ldifLines.append('ds-task-rebuild-max-threads: %s' % maxThreads )
|
|
for indexType in attributes:
|
ldifLines.append('ds-task-rebuild-index: %s' % indexType )
|
</script>
|
|
<!-- Write out the rebuildIndex-task ldif -->
|
<script>
|
outfile = open(tmpTaskLdif,"w")
|
|
for line in ldifLines:
|
outfile.write("%s\n" % line)
|
|
outfile.close()
|
</script>
|
|
<!-- Copy the rebuildIndex-task ldif to remote host -->
|
<message>'Copy rebuildIndex task ldif file.'</message>
|
<call function="'copyFile'">
|
{ 'location' : STAXServiceMachine,
|
'srcfile' : tmpTaskLdif,
|
'destfile' : taskLdif,
|
'remotehost' : myLocation }
|
</call>
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message level="'error'">
|
'Copy of totalupdate task failed (STAXCode=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
<!-- Start the task using ldap task interface -->
|
<call function="'StartLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'taskLabel' : 'Online Rebuild Index Task',
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd,
|
'dsTaskLdif' : taskLdif }
|
</call>
|
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message>
|
'Start of rebuild index task failed (Code=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
|
<!-- Check that the ldap task is completed -->
|
<sequence>
|
<call function="'CheckLdapTask'">
|
{ 'location' : myLocation,
|
'dsPath' : myPath,
|
'dsTaskDn' : taskDN,
|
'dsHost' : dsInstanceHost,
|
'dsPort' : dsInstancePort,
|
'dsBindDn' : dsInstanceDn,
|
'dsBindPswd' : dsInstancePswd
|
}
|
</call>
|
</sequence>
|
|
<script>
|
STAXCode, STAXReason=STAXResult
|
</script>
|
|
<if expr="STAXCode != 0">
|
<sequence>
|
<message>
|
'Check of rebuild index task failed (Code=%s)' % STAXCode
|
</message>
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
</if>
|
|
<script>
|
STAXCode=0
|
STAXReason='%s: Success' % STAXCurrentFunction
|
</script>
|
|
<return>[STAXCode, STAXReason]</return>
|
</sequence>
|
|
</function>
|
|
<!-- manage-tasks Function -->
|
<function name="manage-tasks" scope="local">
|
<function-prolog>
|
This function performs a manage-tasks command line
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,OPENDSNAME)">
|
<function-arg-description>
|
Pathname to installation root
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceHost" type="optional">
|
<function-arg-description>
|
Directory server hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceAdminPort"
|
type="optional"
|
default="DIRECTORY_INSTANCE_ADMIN_PORT">
|
<function-arg-description>
|
Directory server admin port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstanceDn" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="dsInstancePswd" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsBindPasswordFile" type="optional">
|
<function-arg-description>
|
Bind password file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStorePath" type="optional">
|
<function-arg-description>
|
Certificate keystore path
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsCertNickname" type="optional">
|
<function-arg-description>
|
Nickname of certificate for SSL client authentication
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsSaslOption" type="optional">
|
<function-arg-description>
|
SASL bind options
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStorePath" type="optional">
|
<function-arg-description>
|
Certificate trust store path
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsUseStartTLS" type="optional">
|
<function-arg-description>
|
Use StartTLS to secure communication with the server
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStorePassword" type="optional">
|
<function-arg-description>
|
Certificate trust store PIN
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStorePasswordFile" type="optional">
|
<function-arg-description>
|
Certificate keystore PIN file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustStorePasswordFile" type="optional">
|
<function-arg-description>
|
Certificate trust store PIN file
|
</function-arg-description>
|
<function-arg-property name="type" value="filename"/>
|
</function-arg-def>
|
<function-arg-def name="dsKeyStorePassword" type="optional">
|
<function-arg-description>
|
Certificate keystore PIN
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsTrustAll" type="optional">
|
<function-arg-description>
|
Trust all server SSL certificates
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsUseSSL" type="optional">
|
<function-arg-description>
|
Use SSL for secure communication with the server
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsCancel" type="optional">
|
<function-arg-description>
|
Specify the task ID to cancel
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsInfo" type="optional">
|
<function-arg-description>
|
Display information for a particular task
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsSummary" type="optional">
|
<function-arg-description>
|
Display information for a particular task
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsQuiet" type="optional">
|
<function-arg-description>
|
Use quiet mode (no output)
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Display Directory Server version information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
|
<!-- Build the Command -->
|
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
</script>
|
|
<!-- Set common ldap arguments -->
|
<call function="'_adminCommonArgs'" />
|
|
<script>
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/manage-tasks%s' % (dsBinPath,fileExt)
|
|
|
|
if dsBindPasswordFile:
|
STAFCmdParamsList.append('-j %s' % dsBindPasswordFile)
|
|
if dsKeyStorePath:
|
STAFCmdParamsList.append('-K %s' % dsKeyStorePath)
|
|
if dsCertNickname:
|
STAFCmdParamsList.append('-N %s' % dsCertNickname)
|
|
if dsSaslOption:
|
STAFCmdParamsList.append('-o %s' % dsSaslOption)
|
|
if dsTrustStorePath:
|
STAFCmdParamsList.append('-P %s' % dsTrustStorePath)
|
|
if dsUseStartTLS:
|
STAFCmdParamsList.append('-q')
|
|
if dsTrustStorePassword:
|
STAFCmdParamsList.append('-T %s' % dsTrustStorePassword)
|
|
if dsKeyStorePasswordFile:
|
STAFCmdParamsList.append('-u %s' % dsKeyStorePasswordFile)
|
|
if dsTrustStorePasswordFile:
|
STAFCmdParamsList.append('-U %s' % dsTrustStorePasswordFile)
|
|
if dsKeyStorePassword:
|
STAFCmdParamsList.append('-W %s' % dsKeyStorePassword)
|
|
if dsUseSSL:
|
STAFCmdParamsList.append('-Z')
|
|
if dsCancel:
|
STAFCmdParamsList.append('-c %s' % dsCancel)
|
|
if dsInfo:
|
STAFCmdParamsList.append('-i %s' % dsInfo)
|
|
if dsSummary:
|
STAFCmdParamsList.append('-s')
|
|
if dsQuiet:
|
STAFCmdParamsList.append('-n')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
</script>
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'">
|
{ 'location' : location,
|
'envCmd' : [ 'LANG=C' , 'LC_ALL=C' ] ,
|
'name' : 'manage-tasks Script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'expectedRC' : expectedRC,
|
'knownIssue' : knownIssue
|
}
|
</call>
|
<return>
|
STAXResult
|
</return>
|
</sequence>
|
</function>
|
|
<function name="CLI_rebuild-index">
|
<function-prolog>
|
This wraps the rebuild-index tool to make it easy to use from STAX
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="baseDN" type="required">
|
<function-arg-description>
|
Specify a back-end supporting indexing and triggers a rebuild of all
|
indexes in the scope of the provided baseDN
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="attributes" type="required">
|
<function-arg-description>
|
Specify a list of attributes to trigger index rebuild on
|
This should be passed on as a python array like
|
[ 'uid', 'telephonenumber' ]
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<script>
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
_cmd='%s/rebuild-index%s' % (dsBinPath,fileExt)
|
_args=' -b %s -i %s' % ( baseDN, ' -i '.join(attributes) )
|
</script>
|
<call function="'runCommand'">
|
{ 'name' : 'rebuild index',
|
'location' : location,
|
'command' : _cmd,
|
'arguments' : _args,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<function name="CLI_verify-index">
|
<function-prolog>
|
This wraps the verify-index tool to make it easy to use from STAX
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="baseDN" type="required">
|
<function-arg-description>
|
Specify a back-end supporting indexing and triggers a verification of all
|
indexes in the scope of the provided baseDN
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="attributes" type="required">
|
<function-arg-description>
|
Specify a list of attributes to trigger index verification on
|
This should be passed as a python array like
|
[ 'uid','telephonenumber' ]
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="clean" type="optional">
|
<function-arg-description>
|
Specify a list of attributes to trigger index verification on
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<script>
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
_cmd='%s/verify-index%s' % (dsBinPath,fileExt)
|
_args=' -b %s -i %s' % ( baseDN, ' -i '.join(attributes) )
|
</script>
|
<call function="'runCommand'">
|
{ 'name' : 'verify index',
|
'location' : location,
|
'command' : _cmd,
|
'arguments' : _args,
|
'expectedRC': expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<!-- This function execute the rebuild-index tool -->
|
<function name="rebuildIndexWithScript" scope="local">
|
<function-prolog>
|
This function execute the rebuild-index tool
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="dsBaseDN" type="required">
|
<function-arg-description>
|
Specify the base DN for which to perform the verification
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsIndexList" type="optional">
|
<function-arg-description>
|
Specify the name of indexes for which to perform the verification
|
This should be passed as a python array like
|
[ 'uid','telephonenumber' ]
|
</function-arg-description>
|
<function-arg-property name="type" value="array"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Display Directory Server version information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/rebuild-index%s' % (dsBinPath,fileExt)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsIndexList:
|
STAFCmdParamsList.append('-i %s' % (' -i '.join(dsIndexList)))
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'Rebuild index script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<!-- This function execute the verify-index tool -->
|
<function name="verifyIndexWithScript" scope="local">
|
<function-prolog>
|
This function execute the verify-index tool
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="dsBaseDN" type="required">
|
<function-arg-description>
|
Specify the base DN for which to perform the verification
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsIndexList" type="optional">
|
<function-arg-description>
|
Specify the name of indexes for which to perform the verification
|
This should be passed as a python array like
|
[ 'uid','telephonenumber' ]
|
</function-arg-description>
|
<function-arg-property name="type" value="array"/>
|
</function-arg-def>
|
<function-arg-def name="dsClean" type="optional">
|
<function-arg-description>
|
Verify that an index is clean
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsCountErrors" type="optional">
|
<function-arg-description>
|
Count the number of errors found during the verification
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Display Directory Server version information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/verify-index%s' % (dsBinPath,fileExt)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsIndexList:
|
STAFCmdParamsList.append('-i %s' % (' -i '.join(dsIndexList)))
|
|
if dsClean:
|
STAFCmdParamsList.append('-c')
|
|
if dsCountErrors:
|
STAFCmdParamsList.append('--countErrors ')
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'Verify index script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<!-- This function execute the list-backends tool -->
|
<function name="listBackendsWithScript" scope="local">
|
<function-prolog>
|
This function execute the list-backends tool
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="dsBaseDN" type="optional">
|
<function-arg-description>
|
Specify the baseDN from which the list-backends utility
|
should list the backend ID
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsBackendID" type="optional">
|
<function-arg-description>
|
Specify the backend ID from which the tool should display
|
the associated base DN
|
</function-arg-description>
|
<function-arg-property name="type" value="array"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Display Directory Server version information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/list-backends%s' % (dsBinPath,fileExt)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsBackendID:
|
STAFCmdParamsList.append('-n %s' % dsBackendID)
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'List backends script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC,
|
'knownIssue' : knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
|
<!-- This function execute the dbtest tool -->
|
<function name="dbtestWithScript" scope="local">
|
<function-prolog>
|
This function execute the dbtest tool
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<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_BIN,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="subcommand" type="required">
|
<function-arg-description>
|
The subcommand for dbtest
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsBaseDN" type="optional">
|
<function-arg-description>
|
Base DN of the entry container to debug
|
</function-arg-description>
|
<function-arg-property name="type" value="dn"/>
|
</function-arg-def>
|
<function-arg-def name="dsBackendID" type="optional">
|
<function-arg-description>
|
Backend ID of the local DB backend to debug
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsDatabaseName" type="optional">
|
<function-arg-description>
|
Name of the database container to debug
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsMinKeyValue" type="optional">
|
<function-arg-description>
|
Only show records with keys that should be ordered after the
|
provided value using the comparator for the database container
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsMaxKeyValue" type="optional">
|
<function-arg-description>
|
Only show records with keys that should be ordered before the
|
provided value using the comparator for the database container
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsSkipDecode" type="optional">
|
<function-arg-description>
|
Skip decoding the local database to their appropriate types.
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsMinDataSize" type="optional">
|
<function-arg-description>
|
Only show records whose data is no smaller than the provided value
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsMaxDataSize" type="optional">
|
<function-arg-description>
|
Only show records whose data is no larger than the provided value
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="dsHelp" type="optional">
|
<function-arg-description>
|
Display this usage information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="dsVersion" type="optional">
|
<function-arg-description>
|
Display Directory Server version information
|
</function-arg-description>
|
<function-arg-property name="type" value="option"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0.
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
<function-arg-def name="knownIssue" type="optional" default="None">
|
<function-arg-description>
|
Known issue. Corresponds to an issue number.
|
</function-arg-description>
|
<function-arg-property name="type" value="string" />
|
</function-arg-def>
|
</function-map-args>
|
<sequence>
|
<!-- Build the Command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if dsPath:
|
dsBinPath='%s/%s' % (dsPath,fileFolder)
|
STAFCmd='%s/dbtest%s' % (dsBinPath,fileExt)
|
|
if subcommand:
|
STAFCmdParamsList.append(subcommand)
|
|
if dsBaseDN:
|
STAFCmdParamsList.append('-b "%s"' % dsBaseDN)
|
|
if dsBackendID:
|
STAFCmdParamsList.append('-n %s' % dsBackendID)
|
|
if dsDatabaseName:
|
STAFCmdParamsList.append('-d %s' % dsDatabaseName)
|
|
if dsMinKeyValue:
|
STAFCmdParamsList.append('-k %s' % dsMinKeyValue)
|
|
if dsMaxKeyValue:
|
STAFCmdParamsList.append('-K %s' % dsMaxKeyValue)
|
|
if dsSkipDecode:
|
STAFCmdParamsList.append('-p')
|
|
if dsMinDataSize:
|
STAFCmdParamsList.append('-s %s' % dsMinDataSize)
|
|
if dsMaxDataSize:
|
STAFCmdParamsList.append('-S %s' % dsMaxDataSize)
|
|
if dsHelp:
|
STAFCmdParamsList.append('-H')
|
|
if dsVersion:
|
STAFCmdParamsList.append('-V')
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
</script>
|
|
<call function="'runCommand'">
|
{
|
'name' : 'Dbtest script',
|
'command' : STAFCmd,
|
'arguments' : STAFCmdParams,
|
'location' : location,
|
'expectedRC' : expectedRC,
|
'knownIssue': knownIssue
|
}
|
</call>
|
|
<return>STAXResult</return>
|
</sequence>
|
</function>
|
</stax>
|