Merge pull request #433 from resin-io/filter-missing-dockerinfo-devices

Filter our devices that do not expose docker socket
This commit is contained in:
Kostas Lekkas 2017-03-09 21:19:23 +00:00 committed by GitHub
commit 29b2f4afa8
2 changed files with 11 additions and 0 deletions

View File

@ -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');

View File

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