diff --git a/CHANGELOG.md b/CHANGELOG.md index 86273c62..92e3547c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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! 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 * Logger: Add unit tests #701 [Petros Angelatos] diff --git a/package.json b/package.json index 2a3075d9..10354d64 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "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.", - "version": "7.16.0", + "version": "7.16.1", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/src/compose/service-manager.coffee b/src/compose/service-manager.coffee index def03832..dd65be9d 100644 --- a/src/compose/service-manager.coffee +++ b/src/compose/service-manager.coffee @@ -100,15 +100,25 @@ module.exports = class ServiceManager extends EventEmitter .then (existingService) => return @docker.getContainer(existingService.containerId) .catch NotFoundError, => - conf = service.toContainerConfig() - nets = service.extraNetworksToJoin() - @logger.logSystemEvent(logTypes.installService, { service }) - @reportNewStatus(mockContainerId, service, 'Installing') - @docker.createContainer(conf) + + @config.get('name') + .then (deviceName) => + service.environment['RESIN_DEVICE_NAME_AT_INIT'] = deviceName + + conf = service.toContainerConfig() + nets = service.extraNetworksToJoin() + + @logger.logSystemEvent(logTypes.installService, { service }) + @reportNewStatus(mockContainerId, service, 'Installing') + + @docker.createContainer(conf) .tap (container) => service.containerId = container.id + Promise.map nets, ({ name, endpointConfig }) => - @docker.getNetwork(name).connect({ Container: container.id, EndpointConfig: endpointConfig }) + @docker + .getNetwork(name) + .connect({ Container: container.id, EndpointConfig: endpointConfig }) .tap => @logger.logSystemEvent(logTypes.installServiceSuccess, { service }) .tapCatch (err) => diff --git a/src/compose/service.coffee b/src/compose/service.coffee index afaabcf7..0c9fbc91 100644 --- a/src/compose/service.coffee +++ b/src/compose/service.coffee @@ -339,7 +339,6 @@ module.exports = class Service RESIN_APP_NAME: appName RESIN_SERVICE_NAME: @serviceName RESIN_DEVICE_UUID: uuid - RESIN_DEVICE_NAME_AT_INIT: name RESIN_DEVICE_TYPE: deviceType RESIN_HOST_OS_VERSION: osVersion RESIN_SUPERVISOR_VERSION: version @@ -713,9 +712,10 @@ module.exports = class Service equalProps = _.isEqual(_.pick(this, propertiesToCompare), _.pick(otherService, propertiesToCompare)) equalEnv = _.isEqual( - _.omit(@environment, [ 'RESIN_DEVICE_NAME_AT_INIT ']), - _.omit(otherService.environment, [ 'RESIN_DEVICE_NAME_AT_INIT ']) + _.omit(@environment, [ 'RESIN_DEVICE_NAME_AT_INIT' ]), + _.omit(otherService.environment, [ 'RESIN_DEVICE_NAME_AT_INIT' ]) ) + equalNetworks = @hasSameNetworks(otherService) equalArrays = _.every arraysToCompare, (property) => _.isEmpty(_.xorWith(this[property], otherService[property], _.isEqual)) diff --git a/test/04-service.spec.coffee b/test/04-service.spec.coffee index 5460f7c6..106e27be 100644 --- a/test/04-service.spec.coffee +++ b/test/04-service.spec.coffee @@ -32,7 +32,6 @@ describe 'compose/service.cofee', -> RESIN_APP_ID: '23' RESIN_APP_NAME: 'awesomeApp' RESIN_DEVICE_UUID: '1234' - RESIN_DEVICE_NAME_AT_INIT: 'awesomeDevice' RESIN_DEVICE_TYPE: 'raspberry-pi' RESIN_HOST_OS_VERSION: 'Resin OS 2.0.2' RESIN_SERVICE_NAME: 'serviceName'