Skip to content

Commit

Permalink
exposed ssh exec options
Browse files Browse the repository at this point in the history
  • Loading branch information
SisterMystery committed Mar 21, 2017
1 parent 03cb052 commit 0d4ce63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/jobs/ssh-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function sshJobFactory(
this.nodeId = this.context.target;
this.commandUtil = new CommandUtil(this.nodeId);
this.commands = this.commandUtil.buildCommands(options.commands);
this.sshExecOptions = options.sshExecOptions;
assert.arrayOfObject(this.commands);
}
util.inherits(SshJob, BaseJob);
Expand All @@ -47,7 +48,7 @@ function sshJobFactory(
.then(function(sshSettings) {
return Promise.reduce(self.commands, function(results, commandData) {
return self.commandUtil.sshExec(
commandData, sshSettings.config, new ssh.Client()
commandData, sshSettings.config, new ssh.Client(), self.sshExecOptions
)
.then(function(result) {
return results.concat([result]);
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/job-utils/command-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function commandUtilFactory(
});
};

CommandUtil.prototype.sshExec = function(cmdObj, sshSettings, sshClient) {
CommandUtil.prototype.sshExec = function(cmdObj, sshSettings, sshClient, execOptions) {
return new Promise(function(resolve, reject) {
if(cmdObj.timeout) {
setTimeout(function() {
Expand All @@ -135,7 +135,7 @@ function commandUtilFactory(
}
var ssh = sshClient;
ssh.on('ready', function() {
ssh.exec(cmdObj.cmd, function(err, stream) {
ssh.exec(cmdObj.cmd, execOptions || {}, function(err, stream) {
if (err) { reject(err); }
stream.on('close', function(code) {
cmdObj.exitCode = code;
Expand Down

0 comments on commit 0d4ce63

Please sign in to comment.