Fix issue where os download would always download prod images

This also adds support for submodules using resin-sdk shared options
rather than resin-sdk-preconfigured.

Change-Type: patch
Connects-To: #688
This commit is contained in:
Tim Perry 2017-10-17 17:28:40 +02:00
parent 6b96fe37ba
commit 0e4c6c459c
5 changed files with 26 additions and 2 deletions

View File

@ -33,6 +33,9 @@ formatVersion = function(v, isRecommended) {
resolveVersion = function(deviceType, version) {
var form, resin;
if (version !== 'menu') {
if (version[0] === 'v') {
version = version.slice(1);
}
return Promise.resolve(version);
}
form = require('resin-cli-form');

View File

@ -64,6 +64,13 @@ capitano = require('capitano');
capitanoExecuteAsync = Promise.promisify(capitano.execute);
require('resin-sdk').setSharedOptions({
apiUrl: settings.get('apiUrl'),
imageMakerUrl: settings.get('imageMakerUrl'),
dataDirectory: settings.get('dataDirectory'),
retries: 2
});
resin = require('resin-sdk-preconfigured');
actions = require('./actions');

View File

@ -25,6 +25,8 @@ formatVersion = (v, isRecommended) ->
resolveVersion = (deviceType, version) ->
if version isnt 'menu'
if version[0] == 'v'
version = version.slice(1)
return Promise.resolve(version)
form = require('resin-cli-form')

View File

@ -60,7 +60,18 @@ _ = require('lodash')
Promise = require('bluebird')
capitano = require('capitano')
capitanoExecuteAsync = Promise.promisify(capitano.execute)
# We don't yet use resin-sdk directly everywhere, but we set up shared
# options correctly so we can do safely in submodules
require('resin-sdk').setSharedOptions(
apiUrl: settings.get('apiUrl')
imageMakerUrl: settings.get('imageMakerUrl')
dataDirectory: settings.get('dataDirectory')
retries: 2
)
# Keep using sdk-preconfigured for now, but only temporarily
resin = require('resin-sdk-preconfigured')
actions = require('./actions')
errors = require('./errors')
events = require('./events')

View File

@ -85,8 +85,9 @@
"resin-docker-build": "^0.4.0",
"resin-doodles": "0.0.1",
"resin-image-fs": "^2.3.0",
"resin-image-manager": "^4.1.1",
"resin-image-manager": "^5.0.0",
"resin-preload": "^4.0.2",
"resin-sdk": "^7.0.0",
"resin-sdk-preconfigured": "^6.9.0",
"resin-settings-client": "^3.6.1",
"resin-stream-logger": "^0.0.4",
@ -104,4 +105,4 @@
"optionalDependencies": {
"removedrive": "^1.0.0"
}
}
}