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!
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]

View File

@ -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",

View File

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