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);
errormsg = failure.getErrormsg();
FailureReason failureReason = failure.getReason();
context.getExecutionListener().log(0, errormsg);
context.getExecutionListener().log(0, errormsg);
throw new FileCopierException("[jsch-scp] Failed copying the file: " + errormsg, failureReason, e);
}
if (!localTempfile.delete()) {
context.getExecutionListener().log(Constants.WARN_LEVEL,
"Unable to remove local temp file: " + localTempfile.getAbsolutePath());
}