From 3df30c8b5abea36beced14aed438c977e7da56e0 Mon Sep 17 00:00:00 2001 From: Eugene Mirotin Date: Thu, 27 Apr 2017 16:18:39 +0300 Subject: [PATCH] fix ssh proxy URL retrieval --- CHANGELOG.md | 4 ++++ build/actions/deploy.js | 2 +- build/actions/ssh.js | 10 +++++----- lib/actions/ssh.coffee | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db838d83..25832416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +### Fixed + +- The `ssh` command was broken + ## [5.8.0] - 2017-04-26 ### Added diff --git a/build/actions/deploy.js b/build/actions/deploy.js index d4251d73..fe7e8653 100644 --- a/build/actions/deploy.js +++ b/build/actions/deploy.js @@ -115,7 +115,7 @@ uploadToPromise = function(request, size, logStreams) { module.exports = { signature: 'deploy [image]', description: 'Deploy a container to a resin.io application', - help: 'Use this command to deploy and optionally build an image to an application.\n\nUsage: deploy ([image] | --build [--source build-dir])\n\nNote: If building with this command, all options supported by `resin build`\nare also support with this command.\n\nExamples:\n$ resin deploy myApp --build --source myBuildDir/\n$ resin deploy myApp myApp/myImage', + help: 'Use this command to deploy and optionally build an image to an application.\n\nUsage: deploy ([image] | --build [--source build-dir])\n\nNote: If building with this command, all options supported by `resin build`\nare also supported with this command.\n\nExamples:\n $ resin deploy myApp --build --source myBuildDir/\n $ resin deploy myApp myApp/myImage', permission: 'user', options: dockerUtils.appendOptions([ { diff --git a/build/actions/ssh.js b/build/actions/ssh.js index 25b905f1..d5451f90 100644 --- a/build/actions/ssh.js +++ b/build/actions/ssh.js @@ -53,12 +53,11 @@ module.exports = { } ], action: function(params, options, done) { - var Promise, child_process, patterns, proxyUrl, resin, verbose; + var Promise, child_process, patterns, resin, verbose; child_process = require('child_process'); Promise = require('bluebird'); resin = require('resin-sdk-preconfigured'); patterns = require('../utils/patterns'); - proxyUrl = resin.settings.get('proxyUrl'); if (options.port == null) { options.port = 22; } @@ -83,10 +82,11 @@ module.exports = { return Promise.props({ username: resin.auth.whoami(), uuid: device.uuid, - containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId') + containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId'), + proxyUrl: resin.settings.get('proxyUrl') }).then(function(arg) { - var containerId, username, uuid; - username = arg.username, uuid = arg.uuid, containerId = arg.containerId; + var containerId, proxyUrl, username, uuid; + username = arg.username, uuid = arg.uuid, containerId = arg.containerId, proxyUrl = arg.proxyUrl; if (containerId == null) { throw new Error('Did not find running application container'); } diff --git a/lib/actions/ssh.coffee b/lib/actions/ssh.coffee index 9236ddd5..dcd37e9a 100644 --- a/lib/actions/ssh.coffee +++ b/lib/actions/ssh.coffee @@ -71,7 +71,6 @@ module.exports = Promise = require 'bluebird' resin = require('resin-sdk-preconfigured') patterns = require('../utils/patterns') - proxyUrl = resin.settings.get('proxyUrl') if not options.port? options.port = 22 @@ -95,7 +94,8 @@ module.exports = uuid: device.uuid # get full uuid containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId') - .then ({ username, uuid, containerId }) -> + proxyUrl: resin.settings.get('proxyUrl') + .then ({ username, uuid, containerId, proxyUrl }) -> throw new Error('Did not find running application container') if not containerId? Promise.try -> command = "ssh #{verbose} -t \