mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 02:01:35 +00:00
state: Don't consider local mode when storing state
Change-type: patch Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
5906e1427c
commit
479e0a8bb8
@ -242,12 +242,10 @@ module.exports = class DeviceState extends EventEmitter
|
||||
|
||||
setTarget: (target, localSource = false) ->
|
||||
Promise.join(
|
||||
@config.getMany(['apiEndpoint', 'localMode']),
|
||||
@config.get('apiEndpoint'),
|
||||
validateState(target),
|
||||
({ apiEndpoint, localMode }) =>
|
||||
(apiEndpoint) =>
|
||||
source = apiEndpoint
|
||||
if (validation.checkTruthy(localMode))
|
||||
source = 'local'
|
||||
@usingWriteLockTarget =>
|
||||
# Apps, deviceConfig, dependent
|
||||
@db.transaction (trx) =>
|
||||
@ -257,7 +255,7 @@ module.exports = class DeviceState extends EventEmitter
|
||||
@deviceConfig.setTarget(target.local.config, trx)
|
||||
.then =>
|
||||
if localSource
|
||||
@applications.setTarget(target.local.apps, target.dependent, source, trx)
|
||||
@applications.setTarget(target.local.apps, target.dependent, 'local', trx)
|
||||
else
|
||||
@applications.setTarget(target.local.apps, target.dependent, apiEndpoint, trx)
|
||||
)
|
||||
@ -492,6 +490,7 @@ module.exports = class DeviceState extends EventEmitter
|
||||
|
||||
triggerApplyTarget: ({ force = false, delay = 0, initial = false } = {}) =>
|
||||
if @applyInProgress
|
||||
console.log('==> Apply in progress')
|
||||
if !@scheduledApply?
|
||||
@scheduledApply = { force, delay }
|
||||
else
|
||||
@ -507,6 +506,7 @@ module.exports = class DeviceState extends EventEmitter
|
||||
console.log('Applying target state')
|
||||
@applyTarget({ force, initial })
|
||||
.finally =>
|
||||
console.log('==> Done applying target state!')
|
||||
@applyInProgress = false
|
||||
@reportCurrentState()
|
||||
if @scheduledApply?
|
||||
|
Loading…
x
Reference in New Issue
Block a user