From 7aee4d6d7fef72603ce4e956bd068d3a2b57dde3 Mon Sep 17 00:00:00 2001 From: Kostas Lekkas Date: Thu, 9 Mar 2017 19:52:19 +0000 Subject: [PATCH] Filter our devices that do not expose docker socket --- build/actions/local/scan.js | 8 ++++++++ lib/actions/local/scan.coffee | 3 +++ 2 files changed, 11 insertions(+) diff --git a/build/actions/local/scan.js b/build/actions/local/scan.js index 141057b4..f79e5e71 100644 --- a/build/actions/local/scan.js +++ b/build/actions/local/scan.js @@ -58,6 +58,14 @@ limitations under the License. startMessage: 'Scanning for local resinOS devices..', stopMessage: 'Reporting scan results' }); + }).filter(function(arg) { + var address, docker; + address = arg.address; + docker = new Docker({ + host: address, + port: 2375 + }); + return docker.infoAsync()["return"](true).catchReturn(false); }).tap(function(devices) { if (_.isEmpty(devices)) { throw new Error('Could not find any resinOS devices in the local network'); diff --git a/lib/actions/local/scan.coffee b/lib/actions/local/scan.coffee index d119e988..cf20c410 100644 --- a/lib/actions/local/scan.coffee +++ b/lib/actions/local/scan.coffee @@ -72,6 +72,9 @@ module.exports = promise: discover.discoverLocalResinOsDevices(options.timeout) startMessage: 'Scanning for local resinOS devices..' stopMessage: 'Reporting scan results' + .filter ({ address }) -> + docker = new Docker(host: address, port: 2375) + docker.infoAsync().return(true).catchReturn(false) .tap (devices) -> if _.isEmpty(devices) throw new Error('Could not find any resinOS devices in the local network')