Fix semver comparison for OS version when determining if the device has deviceApiKey support

The current setup would cause the check to always fail - the consequence is not *that* bad since
the provisioning key still gets overwritten, but it's better to delete it if we can.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2017-07-04 02:24:09 -07:00
parent c9b42b83b4
commit 8b2138f744

View File

@ -12,7 +12,7 @@ deviceConfig = require './device-config'
TypedError = require 'typed-error'
osRelease = require './lib/os-release'
semver = require 'semver'
semverRegex = require('semver-regex')()
semverRegex = require('semver-regex')
userConfig = {}
@ -169,7 +169,7 @@ bootstrapOrRetry = ->
hasDeviceApiKeySupport = (osVersion) ->
try
!/^Resin OS /.test(osVersion) or semver.gte(semverRegex.test(osVersion), '2.0.2')
!/^Resin OS /.test(osVersion) or semver.gte(semverRegex().exec(osVersion)[0], '2.0.2')
catch err
console.error('Unable to determine if device has deviceApiKey support', err, err.stack)
false