mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-29 15:44:13 +00:00
unmanged: Don't require a device name when setting a target state
Also set a default device name of 'local', to avoid an undefined value. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
eda477ff86
commit
64a8c03eba
@ -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' },
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user