Merge pull request #1083 from balena-io/dont-offer-to-disable-automatic-updates-when-device-is-pinned

Don't offer to disable automatic application updates when using pinning
This commit is contained in:
Alexis Svinartchouk 2019-01-22 15:00:21 +01:00 committed by GitHub
commit a8de833c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,12 +98,12 @@ selectApplicationCommit = (releases) ->
default: LATEST default: LATEST
choices: choices choices: choices
offerToDisableAutomaticUpdates = (application, commit) -> offerToDisableAutomaticUpdates = (application, commit, pinDevice) ->
Promise = require('bluebird') Promise = require('bluebird')
balena = require('balena-sdk').fromSharedOptions() balena = require('balena-sdk').fromSharedOptions()
form = require('resin-cli-form') form = require('resin-cli-form')
if commit == LATEST or not application.should_track_latest_release if commit == LATEST or not application.should_track_latest_release or pinDevice
return Promise.resolve() return Promise.resolve()
message = ''' message = '''
@ -115,6 +115,8 @@ offerToDisableAutomaticUpdates = (application, commit) ->
Warning: To re-enable this requires direct api calls, Warning: To re-enable this requires direct api calls,
see https://balena.io/docs/reference/api/resources/device/#set-device-to-release see https://balena.io/docs/reference/api/resources/device/#set-device-to-release
Alternatively you can pass the --pin-device-to-release flag to pin only this device to the selected release.
''' '''
form.ask form.ask
message: message, message: message,
@ -289,7 +291,7 @@ module.exports =
preloader.commit = commit preloader.commit = commit
# Propose to disable automatic app updates if the commit is not the latest # Propose to disable automatic app updates if the commit is not the latest
offerToDisableAutomaticUpdates(preloader.application, commit) offerToDisableAutomaticUpdates(preloader.application, commit, options.pinDevice)
.then -> .then ->
# All options are ready: preload the image. # All options are ready: preload the image.
preloader.preload() preloader.preload()