fix: Properly get the config from target state before comparing during initial config reporting

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
This commit is contained in:
Pablo Carranza Velez 2018-10-22 13:18:53 -07:00
parent beae3e03c5
commit f5b005bcb2

View File

@ -316,13 +316,12 @@ module.exports = class APIBinder
_reportInitialEnv: (apiEndpoint) => _reportInitialEnv: (apiEndpoint) =>
Promise.join( Promise.join(
@deviceState.getCurrentForComparison() @deviceState.getCurrentForComparison()
@getTargetState().then (conf) => @getTargetState().then (targetState) =>
@deviceState.deviceConfig.formatConfigKeys(conf) @deviceState.deviceConfig.formatConfigKeys(targetState.local.config)
@deviceState.deviceConfig.getDefaults() @deviceState.deviceConfig.getDefaults()
@config.get('deviceId') @config.get('deviceId')
(currentState, targetState, defaultConfig, deviceId) => (currentState, targetConfig, defaultConfig, deviceId) =>
currentConfig = currentState.local.config currentConfig = currentState.local.config
targetConfig = targetState.local.config
Promise.mapSeries _.toPairs(currentConfig), ([ key, value ]) => Promise.mapSeries _.toPairs(currentConfig), ([ key, value ]) =>
# We never want to disable VPN if, for instance, it failed to start so far # We never want to disable VPN if, for instance, it failed to start so far
if key == 'SUPERVISOR_VPN_CONTROL' if key == 'SUPERVISOR_VPN_CONTROL'