Auto-merge for PR #704 via VersionBot

Dont restart service on device name change
This commit is contained in:
resin-io-versionbot[bot] 2018-07-25 10:47:07 +00:00 committed by GitHub
commit e85cc6e04f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 11 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## v7.16.1 - 2018-07-25
* Dont restart service on device name change #704 [Cameron Diver]
## v7.16.0 - 2018-07-23 ## v7.16.0 - 2018-07-23
* Logger: Add unit tests #701 [Petros Angelatos] * Logger: Add unit tests #701 [Petros Angelatos]

View File

@ -1,7 +1,7 @@
{ {
"name": "resin-supervisor", "name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "7.16.0", "version": "7.16.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -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, =>
conf = service.toContainerConfig()
nets = service.extraNetworksToJoin() @config.get('name')
@logger.logSystemEvent(logTypes.installService, { service }) .then (deviceName) =>
@reportNewStatus(mockContainerId, service, 'Installing') service.environment['RESIN_DEVICE_NAME_AT_INIT'] = deviceName
@docker.createContainer(conf)
conf = service.toContainerConfig()
nets = service.extraNetworksToJoin()
@logger.logSystemEvent(logTypes.installService, { service })
@reportNewStatus(mockContainerId, service, 'Installing')
@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) =>

View File

@ -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))

View File

@ -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'