mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 08:25:36 +00:00
Dont restart service on device name change
Change-type: patch Closes: #659 Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
065f79390f
commit
f7958e6c6b
@ -100,15 +100,25 @@ module.exports = class ServiceManager extends EventEmitter
|
|||||||
.then (existingService) =>
|
.then (existingService) =>
|
||||||
return @docker.getContainer(existingService.containerId)
|
return @docker.getContainer(existingService.containerId)
|
||||||
.catch NotFoundError, =>
|
.catch NotFoundError, =>
|
||||||
|
|
||||||
|
@config.get('name')
|
||||||
|
.then (deviceName) =>
|
||||||
|
service.environment['RESIN_DEVICE_NAME_AT_INIT'] = deviceName
|
||||||
|
|
||||||
conf = service.toContainerConfig()
|
conf = service.toContainerConfig()
|
||||||
nets = service.extraNetworksToJoin()
|
nets = service.extraNetworksToJoin()
|
||||||
|
|
||||||
@logger.logSystemEvent(logTypes.installService, { service })
|
@logger.logSystemEvent(logTypes.installService, { service })
|
||||||
@reportNewStatus(mockContainerId, service, 'Installing')
|
@reportNewStatus(mockContainerId, service, 'Installing')
|
||||||
|
|
||||||
@docker.createContainer(conf)
|
@docker.createContainer(conf)
|
||||||
.tap (container) =>
|
.tap (container) =>
|
||||||
service.containerId = container.id
|
service.containerId = container.id
|
||||||
|
|
||||||
Promise.map nets, ({ name, endpointConfig }) =>
|
Promise.map nets, ({ name, endpointConfig }) =>
|
||||||
@docker.getNetwork(name).connect({ Container: container.id, EndpointConfig: endpointConfig })
|
@docker
|
||||||
|
.getNetwork(name)
|
||||||
|
.connect({ Container: container.id, EndpointConfig: endpointConfig })
|
||||||
.tap =>
|
.tap =>
|
||||||
@logger.logSystemEvent(logTypes.installServiceSuccess, { service })
|
@logger.logSystemEvent(logTypes.installServiceSuccess, { service })
|
||||||
.tapCatch (err) =>
|
.tapCatch (err) =>
|
||||||
|
@ -339,7 +339,6 @@ module.exports = class Service
|
|||||||
RESIN_APP_NAME: appName
|
RESIN_APP_NAME: appName
|
||||||
RESIN_SERVICE_NAME: @serviceName
|
RESIN_SERVICE_NAME: @serviceName
|
||||||
RESIN_DEVICE_UUID: uuid
|
RESIN_DEVICE_UUID: uuid
|
||||||
RESIN_DEVICE_NAME_AT_INIT: name
|
|
||||||
RESIN_DEVICE_TYPE: deviceType
|
RESIN_DEVICE_TYPE: deviceType
|
||||||
RESIN_HOST_OS_VERSION: osVersion
|
RESIN_HOST_OS_VERSION: osVersion
|
||||||
RESIN_SUPERVISOR_VERSION: version
|
RESIN_SUPERVISOR_VERSION: version
|
||||||
@ -713,9 +712,10 @@ module.exports = class Service
|
|||||||
|
|
||||||
equalProps = _.isEqual(_.pick(this, propertiesToCompare), _.pick(otherService, propertiesToCompare))
|
equalProps = _.isEqual(_.pick(this, propertiesToCompare), _.pick(otherService, propertiesToCompare))
|
||||||
equalEnv = _.isEqual(
|
equalEnv = _.isEqual(
|
||||||
_.omit(@environment, [ 'RESIN_DEVICE_NAME_AT_INIT ']),
|
_.omit(@environment, [ 'RESIN_DEVICE_NAME_AT_INIT' ]),
|
||||||
_.omit(otherService.environment, [ 'RESIN_DEVICE_NAME_AT_INIT '])
|
_.omit(otherService.environment, [ 'RESIN_DEVICE_NAME_AT_INIT' ])
|
||||||
)
|
)
|
||||||
|
|
||||||
equalNetworks = @hasSameNetworks(otherService)
|
equalNetworks = @hasSameNetworks(otherService)
|
||||||
equalArrays = _.every arraysToCompare, (property) =>
|
equalArrays = _.every arraysToCompare, (property) =>
|
||||||
_.isEmpty(_.xorWith(this[property], otherService[property], _.isEqual))
|
_.isEmpty(_.xorWith(this[property], otherService[property], _.isEqual))
|
||||||
|
@ -32,7 +32,6 @@ describe 'compose/service.cofee', ->
|
|||||||
RESIN_APP_ID: '23'
|
RESIN_APP_ID: '23'
|
||||||
RESIN_APP_NAME: 'awesomeApp'
|
RESIN_APP_NAME: 'awesomeApp'
|
||||||
RESIN_DEVICE_UUID: '1234'
|
RESIN_DEVICE_UUID: '1234'
|
||||||
RESIN_DEVICE_NAME_AT_INIT: 'awesomeDevice'
|
|
||||||
RESIN_DEVICE_TYPE: 'raspberry-pi'
|
RESIN_DEVICE_TYPE: 'raspberry-pi'
|
||||||
RESIN_HOST_OS_VERSION: 'Resin OS 2.0.2'
|
RESIN_HOST_OS_VERSION: 'Resin OS 2.0.2'
|
||||||
RESIN_SERVICE_NAME: 'serviceName'
|
RESIN_SERVICE_NAME: 'serviceName'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user