| 9 | var _connections = []; |
| 10 | |
| 11 | function connect(_context) { |
| 12 | var future = new Future(); |
| 13 | |
| 14 | new Fiber(function() { |
| 15 | logger.info("Connecting to '" + _context.remote.host + "'"); |
| 16 | |
| 17 | try { |
| 18 | var connection = new SSH(_context); |
| 19 | _connections.push(connection); |
| 20 | } catch(e) { |
| 21 | if(!_context.remote.failsafe) { |
| 22 | throw new errors.ConnectionFailedError("Error connecting to '" + |
| 23 | _context.remote.host + "': " + e.message); |
| 24 | } |
| 25 | |
| 26 | logger.warn("Safely failed connecting to '" + |
| 27 | _context.remote.host + "': " + e.message); |
| 28 | } |
| 29 | |
| 30 | return future.return(); |
| 31 | }).run(); |
| 32 | |
| 33 | return future; |
| 34 | } |
| 35 | |
| 36 | function execute(transport, fn) { |
| 37 | var future = new Future(); |