final INodeEntry node,
final String destinationPath
) throws FileCopierException {
Project project = new Project();
final Sequential seq = new Sequential();
seq.setProject(project);
final String remotefile;
if(null==destinationPath) {
remotefile = generateRemoteFilepathForNode(node, (null != scriptfile ? scriptfile.getName()
: "dispatch-script"));
}else {
remotefile = destinationPath;
}
//write to a local temp file or use the input file
final File localTempfile =
null != scriptfile ?
scriptfile :
writeTempFile(
context,
scriptfile,
input,
script
);
// logger.debug("temp file for node " + node.getNodename() + ": " + temp.getAbsolutePath() + ",
// datacontext: " + dataContext);
final Task scp;
final JschNodeExecutor.NodeSSHConnectionInfo nodeAuthentication = new JschNodeExecutor.NodeSSHConnectionInfo(
node,
framework,
context);
try {
scp = SSHTaskBuilder.buildScp(node, project, remotefile, localTempfile, nodeAuthentication,
context.getLoglevel(),context.getExecutionListener());
} catch (SSHTaskBuilder.BuilderException e) {
throw new FileCopierException("Configuration error: " + e.getMessage(),
StepFailureReason.ConfigurationFailure, e);
}
/**
* Copy the file over
*/
seq.addTask(createEchoVerbose("copying scriptfile: '" + localTempfile.getAbsolutePath()
+ "' to: '" + node.getNodename() + ":" + remotefile + "'", project));
seq.addTask(scp);
String errormsg = null;
try {
seq.execute();
} catch (BuildException e) {
JschNodeExecutor.ExtractFailure failure = JschNodeExecutor.extractFailure(e,
node,
nodeAuthentication.getSSHTimeout(),
framework);