diff --git a/CHANGELOG.md b/CHANGELOG.md index 1191de33..4f9dd224 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/). +## v6.5.7 - 2018-01-05 + +* Avoid problems with null app names or invalid container names when migrating from old supervisors #541 [Pablo Carranza Velez] + ## v6.5.6 - 2017-12-15 * Update-locking: updating the documentation with extra information and tools #528 [Gergely Imreh] diff --git a/package.json b/package.json index 648b1bf6..52b4ae1e 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": "6.5.6", + "version": "6.5.7", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/src/application.coffee b/src/application.coffee index ccb7fe14..6d61279e 100644 --- a/src/application.coffee +++ b/src/application.coffee @@ -288,7 +288,7 @@ isExecFormatError = (err) -> generateContainerName = (app) -> randomHexString.generate() .then (randomString) -> - sanitisedAppName = app.name.replace(/[^a-zA-Z0-9]+/g, '_') + sanitisedAppName = (app.name ? 'app').replace(/[^a-zA-Z0-9]+/g, '_') return "#{sanitisedAppName}_#{randomString}" application.start = start = (app) -> @@ -944,7 +944,10 @@ migrateContainerIdApps = -> docker.getContainer(app.containerId).inspect() .catchReturn({ Name: null }) .then (container) -> - app.containerName = sanitiseContainerName(container.Name) + if container.Name? + app.containerName = sanitiseContainerName(container.Name) + else + app.containerName = null app.containerId = null knex('app').update(app).where({ id: app.id }) .then ->