Up max comment length to 120 chars.

This commit is contained in:
Lorenzo Stoakes 2014-09-15 15:04:38 +01:00 committed by Pablo Carranza Vélez
parent f39b51885d
commit 3810a394c9
5 changed files with 17 additions and 20 deletions

View File

@ -22,8 +22,7 @@ Promise.promisifyAll(docker.getContainer().__proto__)
pubnub = PUBNUB.init(config.pubnub) pubnub = PUBNUB.init(config.pubnub)
# Queue up any calls to publish while we wait for the uuid to return from # Queue up any calls to publish while we wait for the uuid to return from the sqlite db
# the sqlite db
publish = do -> publish = do ->
publishQueue = [] publishQueue = []
@ -55,7 +54,8 @@ exports.kill = kill = (app) ->
container.removeAsync() container.removeAsync()
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function. # Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
.catch Promise.OperationalError, (err) -> .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 statusCode = '' + err.cause.statusCode
# 304 means the container was already stopped - so we can just remove it # 304 means the container was already stopped - so we can just remove it
if statusCode is '304' if statusCode is '304'
@ -129,8 +129,8 @@ exports.start = start = (app) ->
ExposedPorts: ports ExposedPorts: ports
) )
.tap (container) -> .tap (container) ->
# Update the app info the moment we create the container, even if then starting the container fails. # Update the app info the moment we create the container, even if then starting the container fails. This
# This stops issues with constantly creating new containers for an image that fails to start. # stops issues with constantly creating new containers for an image that fails to start.
app.containerId = container.id app.containerId = container.id
if app.id? if app.id?
knex('app').update(app).where(id: app.id) knex('app').update(app).where(id: app.id)
@ -258,8 +258,8 @@ exports.update = update = ->
.then -> .then ->
failedUpdates = 0 failedUpdates = 0
updateDeviceInfo(status: 'Cleaning old images') updateDeviceInfo(status: 'Cleaning old images')
# We cleanup here as we want a point when we have a consistent apps/images state, # We cleanup here as we want a point when we have a consistent apps/images state, rather than potentially at a
# rather than potentially at a point where we might clean up an image we still want. # point where we might clean up an image we still want.
cleanupImages() cleanupImages()
.catch (err) -> .catch (err) ->
failedUpdates++ failedUpdates++

View File

@ -15,12 +15,10 @@ module.exports = ->
version = utils.getSupervisorVersion() version = utils.getSupervisorVersion()
# I'd be nice if the UUID matched the output of a SHA-256 function, but # I'd be nice if the UUID matched the output of a SHA-256 function, but although the length limit of the CN
# although the length limit of the CN attribute in a X.509 certificate is # attribute in a X.509 certificate is 64 chars, a 32 byte UUID (64 chars in hex) doesn't pass the certificate
# 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
# validation in OpenVPN This either means that the RFC counts a final NULL # OpenVPN/OpenSSL implementation has a bug.
# byte as part of the CN or that the OpenVPN/OpenSSL implementation has a
# bug.
uuid = crypto.pseudoRandomBytes(31).toString('hex') uuid = crypto.pseudoRandomBytes(31).toString('hex')
# Generate SSL certificate # Generate SSL certificate

View File

@ -86,8 +86,8 @@ exports.initialised = currentSupervisor.then (currentSupervisor) ->
supervisorUpdating = Promise.resolve() supervisorUpdating = Promise.resolve()
exports.update = -> exports.update = ->
# Make sure only one attempt to update the full supervisor is running at # Make sure only one attempt to update the full supervisor is running at a time, ignoring any errors from
# a time, ignoring any errors from previous update attempts. # previous update attempts.
supervisorUpdating = supervisorUpdating.catch(->).then -> supervisorUpdating = supervisorUpdating.catch(->).then ->
utils.mixpanelTrack('Supervisor update check') utils.mixpanelTrack('Supervisor update check')
console.log('Fetching supervisor:', remoteImage) console.log('Fetching supervisor:', remoteImage)

View File

@ -3,8 +3,8 @@ process.on 'uncaughtException', (e) ->
supervisor = require './supervisor-update' supervisor = require './supervisor-update'
# Make sure the supervisor-update has initialised before we continue, as it will # Make sure the supervisor-update has initialised before we continue, as it will handle restarting to add mounts if
# handle restarting to add mounts if necessary. # necessary.
supervisor.initialised.then -> supervisor.initialised.then ->
knex = require './db' knex = require './db'

View File

@ -35,9 +35,8 @@ exports.findIpAddrs = ->
# We only care about LOCAL routes (not UNICAST or BROADCAST) # We only care about LOCAL routes (not UNICAST or BROADCAST)
if line.match(/LOCAL$/) if line.match(/LOCAL$/)
# Then we make sure the previous line was an ending branch (and # Then we make sure the previous line was an ending branch (and hence contains an IP - 127.0.0.0 has
# hence contains an IP - 127.0.0.0 has BROADCAST and LOCAL # BROADCAST and LOCAL entries)
# entries)
if prevLine.match(/^\|--/) if prevLine.match(/^\|--/)
# Then we remove the ending branch bit # Then we remove the ending branch bit
maybeAddr = prevLine.replace(/^\|--/, '').trim() maybeAddr = prevLine.replace(/^\|--/, '').trim()