Auto-merge for PR #541 via VersionBot

Avoid problems with null app names or invalid container names when migrating from old supervisors
This commit is contained in:
resin-io-versionbot[bot] 2018-01-05 15:54:07 +00:00 committed by GitHub
commit e62da15859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 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/).
## 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 ## v6.5.6 - 2017-12-15
* Update-locking: updating the documentation with extra information and tools #528 [Gergely Imreh] * Update-locking: updating the documentation with extra information and tools #528 [Gergely Imreh]

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": "6.5.6", "version": "6.5.7",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -288,7 +288,7 @@ isExecFormatError = (err) ->
generateContainerName = (app) -> generateContainerName = (app) ->
randomHexString.generate() randomHexString.generate()
.then (randomString) -> .then (randomString) ->
sanitisedAppName = app.name.replace(/[^a-zA-Z0-9]+/g, '_') sanitisedAppName = (app.name ? 'app').replace(/[^a-zA-Z0-9]+/g, '_')
return "#{sanitisedAppName}_#{randomString}" return "#{sanitisedAppName}_#{randomString}"
application.start = start = (app) -> application.start = start = (app) ->
@ -944,7 +944,10 @@ migrateContainerIdApps = ->
docker.getContainer(app.containerId).inspect() docker.getContainer(app.containerId).inspect()
.catchReturn({ Name: null }) .catchReturn({ Name: null })
.then (container) -> .then (container) ->
if container.Name?
app.containerName = sanitiseContainerName(container.Name) app.containerName = sanitiseContainerName(container.Name)
else
app.containerName = null
app.containerId = null app.containerId = null
knex('app').update(app).where({ id: app.id }) knex('app').update(app).where({ id: app.id })
.then -> .then ->