This function checks a return code against an expected return code return code received from command the output of the result the expected return code (list of value : [0] or [0,5]) file descriptor, keywords : NO_FILE { 'returncode' : returncode, 'expected' : expected, 'result' : '', 'status' : 'SUCCESS', 'fileFd' : fileFd } { 'returncode' : returncode, 'expected' : expected, 'result' : result, 'status' : 'ERROR', 'fileFd' : fileFd } _errNum Performs all the preoperations for a phase attribute/value of the tag [[attr1,val1],[attr2,val2],...] '' '=================== START PHASE %s @ %s ========================='\ % (phaseName,phaseStartTime) { 'tagName' : phaseName , 'tagAttr' : tagAttr, 'fileFd' : fileFd } Performs all the post operations for a phase Name of the phase Name of output file descriptor '== Found a TOTAL of %s Error(s)' % (ERR_NUM[0]) '== Found %s Error(s) during this phase' % (ERR_NUM[0]) '=================== STOP PHASE %s ============================' \ % (phaseName) { 'tagName' : 'phaseResult', 'tagAttr' : [['errNum',ERR_NUM[0]]] , 'fileFd' : LOG_MAIN_FD } { 'fileFd' : LOG_MAIN_FD } Sleep for number of milliseconds Location of target host Number of milliseconds to sleep do not write message in log file if set to TRUE Name of output file descriptor { 'tagName' : 'sleep', 'fileFd' : fileFd } { 'fileFd' : fileFd, 'content' : 'sleep for %s milliseconds on %s' % (sleepForMilliSeconds,location) } '%s' % location 'delay' 'delay %i' % sleepForMilliSeconds { 'returncode' : RC , 'result' : STAFResult, 'fileFd' : fileFd } {'fileFd' : fileFd} This function compares two LDIF files and reports the differences in LDIF format Location of target host Pathname to installation root Display Directory Server version information LDIF file to use as the source data LDIF file to use as the target data File to which the diffs should be written Overwrite existing output file rather than append to it Write each attribute-level change as a separate modification per attribute value rather than one modification per entry Help option Name of output file descriptor { 'tagName' : 'ldifDiff', 'fileFd' : fileFd } { 'fileFd' : fileFd, 'content' : 'Compares two LDIF files and reports the differences in LDIF format' } { 'fileFd' : fileFd, 'content' : '%s %s' % (STAFCmd,STAFCmdParams) } location STAFCmd STAFCmdParams dsBinPath ['PATH=/bin:/usr/bin:%s' % dsBinPath] outputLdif { 'returncode' : diffRC, 'result' : 'diff file : %s' % outputLdif, 'fileFd' : fileFd } {'fileFd' : fileFd} diffRC This function compares grep a string in a file Location of target host string to grep File where grep will be done if true, return SUCCESS if string2find is in the file if false, return SUCCESS if string2find is NOT in the file if true, grep with case sensitive mode if false, grep with case insensitive mode Name of output file descriptor { 'tagName' : 'grep', 'fileFd' : fileFd } { 'fileFd' : fileFd, 'content' : "Check '%s' is in %s" % (string2grep,file) } { 'fileFd' : fileFd, 'content' : "Check '%s' is NOT in %s" % (string2grep,file) } location "grep %s '%s' %s" % (options,string2grep,file) ['PATH=/bin:/usr/bin'] { 'returncode' : 0, 'result' : '', 'fileFd' : fileFd } { 'returncode' : grepRC, 'result' : result, 'fileFd' : fileFd } { 'returncode' : 0, 'result' : '', 'fileFd' : fileFd } { 'returncode' : grepRC, 'expected' : [1], 'result' : result, 'fileFd' : fileFd } {'fileFd' : fileFd} Get OS related variables Name of host on which to retrieve variables '%s' % hostname 'var' 'get system var STAF/Config/OS/Name' STAFResult This function returns the date (MONTH/DAY/YEARS-HOURS/MIN) of the OS Location of target host { 'hostname' : location } location 'date /T' '/' location 'time /T' '/' location 'date' "'+%m/%d/%Y-%H:%M:%S'" '/' ['PATH=/bin:/usr/bin'] date A general wrapper to run a command without having to write a dedicated function for it the command to run the path where the command is to be run from the path where the command is to be found the environment variables to set. The default set here should just work for OpenDS commands Which machine should the command be executed on The name to give the process (only matters in the STAX Monitor really) A boolean (use True or False here, case matters) to enable disable stripping the output of a command TODO: consider allowing passing a function name to enable custom output manipulation (overkill?) This argument can only have boolean values The duration that the process is allowed to run Output file containing the command output Path containing the outputFile Expected return code value. Default value is 0. Wildcard 'noCheck' to not check the RC If true, stderr for the command is redirect to stdout. This argument can only have boolean values output file descriptor { 'tagName' : name, 'fileFd' : fileFd } { 'location' : location, 'fileName' : command } { 'content' : 'Running cmd: %s %s' % (command,arguments), 'fileFd' : fileFd } location command arguments path env '%s/%s' % (outputPath, outputFile) location command arguments path env '%s/%s' % (outputPath, outputFile) { 'returncode' : cmdRC, 'result' : cmdOutput, 'expected' : [expectedRC], 'fileFd' : fileFd } { 'content' : 'ERROR : file does not exist on %s : %s'\ % (location,command), 'fileFd' : fileFd } {'fileFd' : fileFd} cmdResult