mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 23:30:48 +00:00
Merge pull request #287 from resin-io/286-fix-restart
Compare config vars to trigger an app restart
This commit is contained in:
commit
d8b85d8c1c
@ -1,3 +1,5 @@
|
|||||||
|
* In delete-then-download, only delete when a download is needed [Pablo]
|
||||||
|
* Compare config vars to trigger an app restart [Pablo]
|
||||||
* Fix disabling logs to display on newer OS with different service name [Pablo]
|
* Fix disabling logs to display on newer OS with different service name [Pablo]
|
||||||
* In cleanup, normalize all image tags for comparison [Pablo]
|
* In cleanup, normalize all image tags for comparison [Pablo]
|
||||||
* Use getRegistryAndName from docker-toolbelt 1.2.0 [Pablo]
|
* Use getRegistryAndName from docker-toolbelt 1.2.0 [Pablo]
|
||||||
|
@ -474,9 +474,13 @@ updateStrategies =
|
|||||||
logSystemEvent(logTypes.updateApp, app) if localApp.imageId == app.imageId
|
logSystemEvent(logTypes.updateApp, app) if localApp.imageId == app.imageId
|
||||||
utils.getKnexApp(localApp.appId)
|
utils.getKnexApp(localApp.appId)
|
||||||
.tap(kill)
|
.tap(kill)
|
||||||
.then(deleteImage)
|
.then (appFromDB) ->
|
||||||
.then ->
|
# If we don't need to download a new image,
|
||||||
fetch(app) if needsDownload
|
# there's no use in deleting the image
|
||||||
|
if needsDownload
|
||||||
|
deleteImage(appFromDB)
|
||||||
|
.then ->
|
||||||
|
fetch(app)
|
||||||
.then ->
|
.then ->
|
||||||
start(app)
|
start(app)
|
||||||
.catch (err) ->
|
.catch (err) ->
|
||||||
@ -540,6 +544,9 @@ formatLocalApps = (apps) ->
|
|||||||
app = _.pick(app, [ 'appId', 'commit', 'imageId', 'env', 'config', 'name' ])
|
app = _.pick(app, [ 'appId', 'commit', 'imageId', 'env', 'config', 'name' ])
|
||||||
return localApps
|
return localApps
|
||||||
|
|
||||||
|
restartVars = (conf) ->
|
||||||
|
return _.pick(conf, [ 'RESIN_DEVICE_RESTART', 'RESIN_RESTART' ])
|
||||||
|
|
||||||
compareForUpdate = (localApps, remoteApps) ->
|
compareForUpdate = (localApps, remoteApps) ->
|
||||||
remoteAppIds = _.keys(remoteApps)
|
remoteAppIds = _.keys(remoteApps)
|
||||||
localAppIds = _.keys(localApps)
|
localAppIds = _.keys(localApps)
|
||||||
@ -551,7 +558,8 @@ compareForUpdate = (localApps, remoteApps) ->
|
|||||||
toBeUpdated = _.filter toBeUpdated, (appId) ->
|
toBeUpdated = _.filter toBeUpdated, (appId) ->
|
||||||
localApp = _.omit(localApps[appId], 'config')
|
localApp = _.omit(localApps[appId], 'config')
|
||||||
remoteApp = _.omit(remoteApps[appId], 'config')
|
remoteApp = _.omit(remoteApps[appId], 'config')
|
||||||
return !_.isEqual(remoteApp, localApp)
|
return !_.isEqual(remoteApp, localApp) or
|
||||||
|
!_.isEqual(restartVars(JSON.parse(localApps[appId].config)), restartVars(JSON.parse(remoteApps[appId].config)))
|
||||||
|
|
||||||
toBeDownloaded = _.filter toBeUpdated, (appId) ->
|
toBeDownloaded = _.filter toBeUpdated, (appId) ->
|
||||||
return !_.isEqual(remoteApps[appId].imageId, localApps[appId].imageId)
|
return !_.isEqual(remoteApps[appId].imageId, localApps[appId].imageId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user