Merge pull request #307 from resin-io/fix-getimageenv

Fix docker utils getImageEnv by correctly parsing the returned array
This commit is contained in:
Pablo Carranza Vélez 2016-10-10 18:59:50 -03:00 committed by GitHub
commit 2331cc7d70
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,4 @@
* Fix docker utils getImageEnv by correctly parsing the returned array [Pablo]
* Avoid installing npm dependencies twice [Pablo]
* Updated to bluebird 3 [Page]
* Better parameter handling in PUT /v1/devices/:uuid [Pablo]

View File

@ -384,6 +384,12 @@ do ->
exports.getImageEnv = (id) ->
docker.getImage(id).inspectAsync()
.get('Config').get('Env')
.then (env) ->
# env is an array of strings that say 'key=value'
_(env)
.invokeMap('split', '=')
.fromPairs()
.value()
.catch (err) ->
console.log('Error getting env from image', err, err.stack)
return {}