From 968d3ce1e3b14766838d8bd40d91b601eef7ced6 Mon Sep 17 00:00:00 2001 From: Pablo Carranza Velez Date: Fri, 12 Jan 2018 11:53:50 -0300 Subject: [PATCH 1/2] Fix saving deviceApiKey to the DB (to fix the RESIN_API_KEY env var) when updating from some older supervisors Change-Type: patch Signed-off-by: Pablo Carranza Velez --- src/bootstrap.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bootstrap.coffee b/src/bootstrap.coffee index d35303c7..c2943866 100644 --- a/src/bootstrap.coffee +++ b/src/bootstrap.coffee @@ -223,6 +223,17 @@ bootstrapper.done = new Promise (resolve) -> # This will only be the case when the supervisor/OS has been updated. if userConfig.apiKey? exchangeKeyOrRetry() + else + Promise.join( + knex('config').select('value').where(key: 'apiKey') + knex('config').select('value').where(key: 'deviceApiKey') + ([ apiKey ], [ deviceApiKey ]) -> + if !deviceApiKey?.value + # apiKey in the DB is actually the deviceApiKey, but it was + # exchanged in a supervisor version that didn't save it to the DB + # (which mainly affects the RESIN_API_KEY env var) + knex('config').insert({ key: 'deviceApiKey', value: apiKey.value }) + ) return bootstrapper.bootstrapped = false From c11cae4777a15e982589cd7c238be8ec80767143 Mon Sep 17 00:00:00 2001 From: "resin-io-versionbot[bot]" Date: Fri, 12 Jan 2018 15:43:08 +0000 Subject: [PATCH 2/2] v6.5.9 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c48b2b4..ca7c8ae7 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.9 - 2018-01-12 + +* Fix saving deviceApiKey to the DB (to fix the RESIN_API_KEY env var) when updating from some older supervisors #544 [Pablo Carranza Velez] + ## v6.5.8 - 2018-01-10 * Update docker-toolbelt to v3.2.1 to fix a bug in deltas #543 [Pablo Carranza Velez] diff --git a/package.json b/package.json index 33260304..67c9db39 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.8", + "version": "6.5.9", "license": "Apache-2.0", "repository": { "type": "git",