mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 02:40:03 +00:00
Remove inotify and lint changes
This commit is contained in:
parent
a4966a798a
commit
a57c723e8a
@ -14,7 +14,6 @@
|
|||||||
"dockerode": "~2.2.1",
|
"dockerode": "~2.2.1",
|
||||||
"event-stream": "^3.0.20",
|
"event-stream": "^3.0.20",
|
||||||
"express": "^4.0.0",
|
"express": "^4.0.0",
|
||||||
"inotify": "^1.4.0",
|
|
||||||
"knex": "~0.8.3",
|
"knex": "~0.8.3",
|
||||||
"lodash": "^3.0.0",
|
"lodash": "^3.0.0",
|
||||||
"mixpanel": "0.0.20",
|
"mixpanel": "0.0.20",
|
||||||
|
@ -6,8 +6,6 @@ mixpanel = require 'mixpanel'
|
|||||||
networkCheck = require 'network-checker'
|
networkCheck = require 'network-checker'
|
||||||
blink = require('blinking')(config.ledFile)
|
blink = require('blinking')(config.ledFile)
|
||||||
url = require 'url'
|
url = require 'url'
|
||||||
Inotify = require('inotify').Inotify
|
|
||||||
inotify = new Inotify()
|
|
||||||
fs = Promise.promisifyAll require 'fs'
|
fs = Promise.promisifyAll require 'fs'
|
||||||
|
|
||||||
utils = exports
|
utils = exports
|
||||||
@ -75,18 +73,9 @@ disableConnectivityCheck = false
|
|||||||
# options: An object of net.connect options, with the addition of:
|
# options: An object of net.connect options, with the addition of:
|
||||||
# timeout: 10s
|
# timeout: 10s
|
||||||
checkHost = (options) ->
|
checkHost = (options) ->
|
||||||
new Promise (resolve, reject) ->
|
if disableConnectivityCheck or pauseConnectivityCheck
|
||||||
if disableConnectivityCheck
|
|
||||||
resolve()
|
|
||||||
else
|
|
||||||
if pauseConnectivityCheck
|
|
||||||
resolve()
|
|
||||||
else
|
|
||||||
reject()
|
|
||||||
.then ->
|
|
||||||
return true
|
return true
|
||||||
.catch ->
|
return networkCheck.checkHost(options)
|
||||||
return networkCheck.checkHost(options)
|
|
||||||
|
|
||||||
# Custom monitor that uses checkHost function above.
|
# Custom monitor that uses checkHost function above.
|
||||||
customMonitor = (options, fn) ->
|
customMonitor = (options, fn) ->
|
||||||
@ -101,23 +90,18 @@ exports.disableCheck = (disable) ->
|
|||||||
disableConnectivityCheck = disable
|
disableConnectivityCheck = disable
|
||||||
|
|
||||||
# Call back for inotify triggered when the VPN status is changed.
|
# Call back for inotify triggered when the VPN status is changed.
|
||||||
vpnStatusInotifyCallback = (arg) ->
|
vpnStatusInotifyCallback = ->
|
||||||
fs.lstatAsync(config.vpnStatusPath+'/active')
|
fs.lstatAsync(config.vpnStatusPath + '/active')
|
||||||
.then ->
|
.then ->
|
||||||
pauseConnectivityCheck=true
|
pauseConnectivityCheck = true
|
||||||
.catch ->
|
.catch ->
|
||||||
pauseConnectivityCheck=false
|
pauseConnectivityCheck = false
|
||||||
|
|
||||||
vpn_status =
|
|
||||||
path: config.vpnStatusPath
|
|
||||||
watch_for: Inotify.IN_DELETE | Inotify.IN_CREATE
|
|
||||||
callback: vpnStatusInotifyCallback
|
|
||||||
|
|
||||||
exports.connectivityCheck = _.once ->
|
exports.connectivityCheck = _.once ->
|
||||||
parsedUrl = url.parse(config.apiEndpoint)
|
parsedUrl = url.parse(config.apiEndpoint)
|
||||||
fs.mkdirAsync(vpn_status.path)
|
fs.mkdirAsync(config.vpnStatusPath)
|
||||||
.then ->
|
.then ->
|
||||||
inotify.addWatch(vpn_status)
|
fs.watch(config.vpnStatusPath, vpnStatusInotifyCallback)
|
||||||
.catch (error) ->
|
.catch (error) ->
|
||||||
if error.code != 'EEXIST'
|
if error.code != 'EEXIST'
|
||||||
throw error
|
throw error
|
||||||
|
Loading…
Reference in New Issue
Block a user