Merge pull request #826 from balena-io/local-mode-unmanaged-fixes

Local mode unmanaged fixes
This commit is contained in:
CameronDiver 2018-11-29 12:42:01 +01:00 committed by GitHub
commit d2fa9994df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 9 deletions

View File

@ -64,7 +64,7 @@ class Config extends EventEmitter {
// NOTE: all 'db' values are stored and loaded as *strings*,
apiSecret: { source: 'db', mutable: true },
name: { source: 'db', mutable: true },
name: { source: 'db', mutable: true, default: 'local' },
initialConfigReported: { source: 'db', mutable: true, default: 'false' },
initialConfigSaved: { source: 'db', mutable: true, default: 'false' },
containersNormalised: { source: 'db', mutable: true, default: 'false' },

View File

@ -13,7 +13,6 @@ module.exports = class DeviceConfig
@rebootRequired = false
@configKeys = {
appUpdatePollInterval: { envVarName: 'SUPERVISOR_POLL_INTERVAL', varType: 'int', defaultValue: '60000' }
localMode: { envVarName: 'SUPERVISOR_LOCAL_MODE', varType: 'bool', defaultValue: 'false' }
connectivityCheckEnabled: { envVarName: 'SUPERVISOR_CONNECTIVITY_CHECK', varType: 'bool', defaultValue: 'true' }
loggingEnabled: { envVarName: 'SUPERVISOR_LOG_CONTROL', varType: 'bool', defaultValue: 'true' }
delta: { envVarName: 'SUPERVISOR_DELTA', varType: 'bool', defaultValue: 'false' }

View File

@ -19,8 +19,8 @@ DeviceConfig = require './device-config'
ApplicationManager = require './application-manager'
validateLocalState = (state) ->
if !state.name? or !validation.isValidShortText(state.name)
throw new Error('Invalid device name')
if state.name?
throw new Error('Invalid device name') if not validation.isValidShortText(state.name)
if !state.apps? or !validation.isValidAppsObject(state.apps)
throw new Error('Invalid apps')
if !state.config? or !validation.isValidEnv(state.config)

View File

@ -58,8 +58,8 @@ describe 'Config', ->
expect(promise).to.eventually.deep.equal({ appUpdatePollInterval: 30000, name: 'a new device name' })
it 'allows removing a db key', ->
promise = @conf.remove('name').then =>
@conf.get('name')
promise = @conf.remove('apiSecret').then =>
@conf.get('apiSecret')
expect(promise).to.be.fulfilled
expect(promise).to.eventually.be.undefined

View File

@ -21,7 +21,6 @@ mockedInitialConfig = {
'RESIN_SUPERVISOR_DELTA_RETRY_COUNT': '30'
'RESIN_SUPERVISOR_DELTA_RETRY_INTERVAL': '10000'
'RESIN_SUPERVISOR_DELTA_VERSION': '2'
'RESIN_SUPERVISOR_LOCAL_MODE': 'false'
'RESIN_SUPERVISOR_LOG_CONTROL': 'true'
'RESIN_SUPERVISOR_OVERRIDE_LOCK': 'false'
'RESIN_SUPERVISOR_POLL_INTERVAL': '60000'
@ -40,7 +39,6 @@ testTarget1 = {
'SUPERVISOR_DELTA_RETRY_COUNT': '30'
'SUPERVISOR_DELTA_RETRY_INTERVAL': '10000'
'SUPERVISOR_DELTA_VERSION': '2'
'SUPERVISOR_LOCAL_MODE': 'false'
'SUPERVISOR_LOG_CONTROL': 'true'
'SUPERVISOR_OVERRIDE_LOCK': 'false'
'SUPERVISOR_POLL_INTERVAL': '60000'
@ -122,7 +120,6 @@ testTargetWithDefaults2 = {
'SUPERVISOR_DELTA_RETRY_COUNT': '30'
'SUPERVISOR_DELTA_RETRY_INTERVAL': '10000'
'SUPERVISOR_DELTA_VERSION': '2'
'SUPERVISOR_LOCAL_MODE': 'false'
'SUPERVISOR_LOG_CONTROL': 'true'
'SUPERVISOR_OVERRIDE_LOCK': 'false'
'SUPERVISOR_POLL_INTERVAL': '60000'