This function copies a source file to destination file to host
Location of target host
The name of remote host (default localhost)
The name of the source fule
The name of the destination fule
The name of the destination fule
file descriptor to write message in
{ 'tagName' : 'copyFile',
'fileFd' : fileFd }
{ 'content' : 'Copy file(s) %s to %s from machine %s to %s' % (srcFile,destFile,location,remoteHost),
'fileFd' : fileFd }
{
'content' : 'SKIP : same file %s, same host %s' % \
(srcFile,location),
'fileFd' : fileFd
}
'%s' % location
'fs'
'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcFile,destFile,remoteHost)
{ 'returncode' : cmdRC ,
'result' : cmdResult,
'fileFd' : fileFd }
'%s' % location
'fs'
'COPY FILE %s TODIRECTORY %s TOMACHINE %s' % (srcFile,destDir,remoteHost)
{ 'returncode' : cmdRC ,
'result' : cmdResult,
'fileFd' : fileFd }
'ERROR copyFile() destFile or destDir must be specified'
{ 'content' : 'ERROR copyFile() destFile or destDir must be specified',
'fileFd' : fileFd }
{'fileFd' : fileFd}
[cmdRC,cmdResult]
This function copy directory through the network
Location of target host
directory to copy
host target where directory will be copied
Directory target
file descriptor to write message in
{ 'tagName' : 'copyFolder',
'fileFd' : fileFd }
{ 'content' : 'Copy directory %s FROM machine %s TO machine %s into %s' %\
(fromDirectory,location,remoteHost,toDirectory),
'fileFd' : fileFd }
{
'content' : 'SKIP : same directory %s, same host %s' % \
(fromDirectory,remoteHost),
'fileFd' : fileFd
}
{
'location' : remoteHost,
'fileName' : toDirectory
}
{
'content' : 'SKIP: remote folder %s exists (NFS?) on %s' % \
(toDirectory,remoteHost),
'fileFd' : fileFd
}
'%s' % location
'fs'
'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE CASEINSENSITIVE' % (fromDirectory,toDirectory,remoteHost)
{ 'returncode' : cmdRC ,
'result' : cmdResult,
'fileFd' : fileFd }
{'fileFd' : fileFd}
cmdRC
This function unzips a compressed zip archive
Location of target host
Name of the file to place zip file contents
Name of destination folder to place zip file contents
file descriptor to write message in
{ 'tagName' : 'Unzip',
'fileFd' : fileFd }
{ 'content' : 'Unzip %s under %s' % (zipfile,unzipdir),
'fileFd' : fileFd }
'%s' % location
'zip'
'UNZIP ZIPFILE %s TODIRECTORY %s RESTOREPERMISSION REPLACE' % (zipfile,unzipdir)
{ 'returncode' : cmdRC ,
'result' : cmdResult,
'fileFd' : fileFd }
{'fileFd' : fileFd}
cmdRC
This function returns TRUE if file exist, else FALSE
Location of target host
Name of file
'%s' % location
'ls'
'%s' % fileName
'/'
['PATH=/bin:/usr/bin']
bExist
This function returns TRUE if file is empty, else FALSE
Location of target host
Name of the file
'%s' % location
'fs'
'GET FILE %s TEXT' % fileName
TRUE
TRUE
FALSE
This function recursively deletes a folder
Location of target host
Name of folder to be deleted
expected return code
file descriptor
{ 'tagName' : 'deleteFolder',
'fileFd' : fileFd }
'Delete folder on %s : %s' % (location,foldername)
'%s' % location
'fs'
'GET ENTRY %s TYPE' % foldername
{ 'content' : 'Folder does not exist, do not delete it.',
'fileFd' : fileFd }
0
{ 'content' : 'Folder exists, will delete it : %s' % foldername,
'fileFd' : fileFd }
'%s' % location
'fs'
'DELETE ENTRY %s RECURSE IGNOREERRORS CONFIRM' % (foldername)
{ 'returncode' : cmdRC ,
'result' : cmdResult,
'expected' : expectedRC,
'fileFd' : fileFd }
{'fileFd' : fileFd}
cmdRC
This function creates a folder
Location of target host
Name of file to be created
file descriptor, wildcard : NO_FILE to not write information in a file
{ 'tagName' : 'createFolder',
'fileFd' : fileFd }
{
'location' : location,
'fileName' : foldername
}
{
'content' : '%s: Directory %s already exists, skip' %\
(location,foldername),
'fileFd' : fileFd
}
{
'content' : 'Create directory %s on %s' % (foldername,location) ,
'fileFd' : fileFd
}
'%s' % location
'fs'
'CREATE DIRECTORY %s FULLPATH' % foldername
{ 'returncode' : cmdRC ,
'result' : cmdResult ,
'fileFd' : fileFd
}
{'fileFd' : fileFd}
cmdRC
This function get the contents of a file
Location of target host
The name of the file
The type of the file
The format of the file
'%s' % location
'fs'
'GET FILE %s %s FORMAT %s' % (filename,type,format)
[cmdRC,cmdResult]