support for triton ssh user@id

This commit is contained in:
Dave Eddy 2015-09-01 10:16:42 -04:00
parent 333c47ae26
commit c4f85db8d8

View File

@ -19,6 +19,14 @@ function do_ssh(subcmd, opts, args, callback) {
} }
var id = args.shift(); var id = args.shift();
var user = 'root';
var i = id.indexOf('@');
if (i >= 0) {
user = id.substr(0, i);
id = id.substr(i + 1);
}
this.triton.getInstance(id, function (err, inst) { this.triton.getInstance(id, function (err, inst) {
if (err) { if (err) {
callback(err); callback(err);
@ -31,7 +39,7 @@ function do_ssh(subcmd, opts, args, callback) {
return; return;
} }
args = ['-l', 'root'].concat(ip).concat(args); args = ['-l', user].concat(ip).concat(args);
self.triton.log.info({args: args}, 'forking ssh'); self.triton.log.info({args: args}, 'forking ssh');
var child = spawn('ssh', args, {stdio: 'inherit'}); var child = spawn('ssh', args, {stdio: 'inherit'});