diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b09c84..039e98ab 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 + +- Capture and report errors happening during the program initialization, like parsing invalid YAML config + ## [5.7.2] - 2017-04-18 ### Fixed diff --git a/build/actions/ssh.js b/build/actions/ssh.js index d60a9570..25b905f1 100644 --- a/build/actions/ssh.js +++ b/build/actions/ssh.js @@ -53,12 +53,12 @@ module.exports = { } ], action: function(params, options, done) { - var Promise, child_process, patterns, resin, settings, verbose; + var Promise, child_process, patterns, proxyUrl, resin, verbose; child_process = require('child_process'); Promise = require('bluebird'); resin = require('resin-sdk-preconfigured'); - settings = require('resin-settings-client'); patterns = require('../utils/patterns'); + proxyUrl = resin.settings.get('proxyUrl'); if (options.port == null) { options.port = 22; } @@ -92,7 +92,7 @@ module.exports = { } return Promise["try"](function() { var command, subShellCommand; - command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -p " + options.port + " " + username + "@ssh." + (settings.get('proxyUrl')) + " enter " + uuid + " " + containerId; + command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -p " + options.port + " " + username + "@ssh." + proxyUrl + " enter " + uuid + " " + containerId; subShellCommand = getSubShellCommand(command); return child_process.spawn(subShellCommand.program, subShellCommand.args, { stdio: 'inherit' diff --git a/build/app.js b/build/app.js index 2590c6d1..8f48271c 100644 --- a/build/app.js +++ b/build/app.js @@ -24,7 +24,10 @@ Raven.disableConsoleAlerts(); Raven.config(require('./config').sentryDsn, { captureUnhandledRejections: true, release: require('../package.json').version -}).install(); +}).install(function(logged, error) { + console.error(error); + return process.exit(1); +}); _ = require('lodash'); diff --git a/lib/actions/ssh.coffee b/lib/actions/ssh.coffee index 51b4e06d..9236ddd5 100644 --- a/lib/actions/ssh.coffee +++ b/lib/actions/ssh.coffee @@ -70,8 +70,8 @@ module.exports = child_process = require('child_process') Promise = require 'bluebird' resin = require('resin-sdk-preconfigured') - settings = require('resin-settings-client') patterns = require('../utils/patterns') + proxyUrl = resin.settings.get('proxyUrl') if not options.port? options.port = 22 @@ -92,7 +92,8 @@ module.exports = Promise.props username: resin.auth.whoami() - uuid: device.uuid # get full uuid + uuid: device.uuid + # get full uuid containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId') .then ({ username, uuid, containerId }) -> throw new Error('Did not find running application container') if not containerId? @@ -102,7 +103,7 @@ module.exports = -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ -o ControlMaster=no \ - -p #{options.port} #{username}@ssh.#{settings.get('proxyUrl')} enter #{uuid} #{containerId}" + -p #{options.port} #{username}@ssh.#{proxyUrl} enter #{uuid} #{containerId}" subShellCommand = getSubShellCommand(command) child_process.spawn subShellCommand.program, subShellCommand.args, diff --git a/lib/app.coffee b/lib/app.coffee index 90c29a5e..b80b7de8 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -16,11 +16,12 @@ limitations under the License. Raven = require('raven') Raven.disableConsoleAlerts() -Raven.config( - require('./config').sentryDsn +Raven.config require('./config').sentryDsn, captureUnhandledRejections: true release: require('../package.json').version -).install() +.install (logged, error) -> + console.error(error) + process.exit(1) _ = require('lodash') Promise = require('bluebird') diff --git a/package.json b/package.json index 712a0430..d95e4f39 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "etcher-image-write": "^9.0.3", "inquirer": "^3.0.6", "is-root": "^1.0.0", - "js-yaml": "^3.7.0", "lodash": "^3.10.0", "mixpanel": "^0.4.0", "moment": "^2.12.0", @@ -63,7 +62,6 @@ "resin-image-fs": "^2.1.2", "resin-image-manager": "^4.1.1", "resin-sdk-preconfigured": "^6.0.0", - "resin-settings-client": "^3.5.0", "resin-sync": "^7.0.0", "rimraf": "^2.4.3", "rindle": "^1.0.0",