Don't remove volumes when switching into local mode

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-07-10 14:14:27 +01:00
parent 050c10dbb0
commit e076622fe6

View File

@ -875,16 +875,19 @@ module.exports = class ApplicationManager extends EventEmitter
# Until then, this essentially does the same thing. We
# check when every other part of the teardown for an
# application has been complete, and then append the
# volume removal steps
# volume removal steps.
# We also don't want to remove cloud volumes when
# switching to local mode
# multi-app warning: this will break
currentAppIds = _.keys(current.local.apps).map((n) -> checkInt(n))
targetAppIds = _.keys(target.local.apps).map((n) -> checkInt(n))
oldApps = null
if targetAppIds.length > 1
throw new Error('Current supervisor does not support multiple applications')
diff = _.difference(currentAppIds, targetAppIds)
if diff.length > 0
oldApps = diff
if !localMode
currentAppIds = _.keys(current.local.apps).map((n) -> checkInt(n))
targetAppIds = _.keys(target.local.apps).map((n) -> checkInt(n))
if targetAppIds.length > 1
throw new Error('Current supervisor does not support multiple applications')
diff = _.difference(currentAppIds, targetAppIds)
if diff.length > 0
oldApps = diff
nextSteps = []
if !supervisorNetworkReady