mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Up max comment length to 120 chars.
This commit is contained in:
parent
f39b51885d
commit
3810a394c9
@ -22,8 +22,7 @@ Promise.promisifyAll(docker.getContainer().__proto__)
|
||||
|
||||
pubnub = PUBNUB.init(config.pubnub)
|
||||
|
||||
# Queue up any calls to publish while we wait for the uuid to return from
|
||||
# the sqlite db
|
||||
# Queue up any calls to publish while we wait for the uuid to return from the sqlite db
|
||||
publish = do ->
|
||||
publishQueue = []
|
||||
|
||||
@ -55,7 +54,8 @@ exports.kill = kill = (app) ->
|
||||
container.removeAsync()
|
||||
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
|
||||
.catch Promise.OperationalError, (err) ->
|
||||
# Get the statusCode from the original cause and make sure statusCode its definitely a string for comparison reasons.
|
||||
# Get the statusCode from the original cause and make sure statusCode its definitely a string for comparison
|
||||
# reasons.
|
||||
statusCode = '' + err.cause.statusCode
|
||||
# 304 means the container was already stopped - so we can just remove it
|
||||
if statusCode is '304'
|
||||
@ -129,8 +129,8 @@ exports.start = start = (app) ->
|
||||
ExposedPorts: ports
|
||||
)
|
||||
.tap (container) ->
|
||||
# Update the app info the moment we create the container, even if then starting the container fails.
|
||||
# This stops issues with constantly creating new containers for an image that fails to start.
|
||||
# Update the app info the moment we create the container, even if then starting the container fails. This
|
||||
# stops issues with constantly creating new containers for an image that fails to start.
|
||||
app.containerId = container.id
|
||||
if app.id?
|
||||
knex('app').update(app).where(id: app.id)
|
||||
@ -258,8 +258,8 @@ exports.update = update = ->
|
||||
.then ->
|
||||
failedUpdates = 0
|
||||
updateDeviceInfo(status: 'Cleaning old images')
|
||||
# We cleanup here as we want a point when we have a consistent apps/images state,
|
||||
# rather than potentially at a point where we might clean up an image we still want.
|
||||
# We cleanup here as we want a point when we have a consistent apps/images state, rather than potentially at a
|
||||
# point where we might clean up an image we still want.
|
||||
cleanupImages()
|
||||
.catch (err) ->
|
||||
failedUpdates++
|
||||
|
@ -15,12 +15,10 @@ module.exports = ->
|
||||
|
||||
version = utils.getSupervisorVersion()
|
||||
|
||||
# I'd be nice if the UUID matched the output of a SHA-256 function, but
|
||||
# although the length limit of the CN attribute in a X.509 certificate is
|
||||
# 64 chars, a 32 byte UUID (64 chars in hex) doesn't pass the certificate
|
||||
# validation in OpenVPN This either means that the RFC counts a final NULL
|
||||
# byte as part of the CN or that the OpenVPN/OpenSSL implementation has a
|
||||
# bug.
|
||||
# I'd be nice if the UUID matched the output of a SHA-256 function, but although the length limit of the CN
|
||||
# attribute in a X.509 certificate is 64 chars, a 32 byte UUID (64 chars in hex) doesn't pass the certificate
|
||||
# validation in OpenVPN This either means that the RFC counts a final NULL byte as part of the CN or that the
|
||||
# OpenVPN/OpenSSL implementation has a bug.
|
||||
uuid = crypto.pseudoRandomBytes(31).toString('hex')
|
||||
|
||||
# Generate SSL certificate
|
||||
|
@ -86,8 +86,8 @@ exports.initialised = currentSupervisor.then (currentSupervisor) ->
|
||||
|
||||
supervisorUpdating = Promise.resolve()
|
||||
exports.update = ->
|
||||
# Make sure only one attempt to update the full supervisor is running at
|
||||
# a time, ignoring any errors from previous update attempts.
|
||||
# Make sure only one attempt to update the full supervisor is running at a time, ignoring any errors from
|
||||
# previous update attempts.
|
||||
supervisorUpdating = supervisorUpdating.catch(->).then ->
|
||||
utils.mixpanelTrack('Supervisor update check')
|
||||
console.log('Fetching supervisor:', remoteImage)
|
||||
|
@ -3,8 +3,8 @@ process.on 'uncaughtException', (e) ->
|
||||
|
||||
supervisor = require './supervisor-update'
|
||||
|
||||
# Make sure the supervisor-update has initialised before we continue, as it will
|
||||
# handle restarting to add mounts if necessary.
|
||||
# Make sure the supervisor-update has initialised before we continue, as it will handle restarting to add mounts if
|
||||
# necessary.
|
||||
supervisor.initialised.then ->
|
||||
knex = require './db'
|
||||
|
||||
|
@ -35,9 +35,8 @@ exports.findIpAddrs = ->
|
||||
|
||||
# We only care about LOCAL routes (not UNICAST or BROADCAST)
|
||||
if line.match(/LOCAL$/)
|
||||
# Then we make sure the previous line was an ending branch (and
|
||||
# hence contains an IP - 127.0.0.0 has BROADCAST and LOCAL
|
||||
# entries)
|
||||
# Then we make sure the previous line was an ending branch (and hence contains an IP - 127.0.0.0 has
|
||||
# BROADCAST and LOCAL entries)
|
||||
if prevLine.match(/^\|--/)
|
||||
# Then we remove the ending branch bit
|
||||
maybeAddr = prevLine.replace(/^\|--/, '').trim()
|
||||
|
Loading…
Reference in New Issue
Block a user