Dont error on a target state with multiple apps

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2020-02-07 11:20:28 +07:00
parent a5b80b9b69
commit a27ce4f1dc
No known key found for this signature in database
GPG Key ID: 49690ED87032539F

View File

@ -862,11 +862,7 @@ module.exports = class ApplicationManager extends EventEmitter
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
appsForVolumeRemoval = _.difference(currentAppIds, targetAppIds)
nextSteps = []
if !supervisorNetworkReady
@ -899,7 +895,7 @@ module.exports = class ApplicationManager extends EventEmitter
allAppIds = _.union(_.keys(currentByAppId), _.keys(targetByAppId))
for appId in allAppIds
nextSteps = nextSteps.concat(@_nextStepsForAppUpdate(currentByAppId[appId], targetByAppId[appId], localMode, containerIds[appId], availableImages, downloading))
if oldApps != null and _.includes(oldApps, checkInt(appId))
if _.includes(appsForVolumeRemoval, checkInt(appId))
# We check if everything else has been done for
# the old app to be removed. If it has, we then
# remove all of the volumes