Let the new supervisor handle tagging itself as a working supervisor, this means that the check that a supervisor update is a working update will not be nullified by a reboot.

This commit is contained in:
Pagan Gazzard 2014-10-01 18:26:32 +01:00 committed by Pablo Carranza Vélez
parent 4cf6ce657a
commit 7f38248cfa
2 changed files with 14 additions and 11 deletions

View File

@ -5,7 +5,6 @@ knex = require './db'
utils = require './utils' utils = require './utils'
{spawn} = require 'child_process' {spawn} = require 'child_process'
bootstrap = require './bootstrap' bootstrap = require './bootstrap'
config = require './config'
utils.mixpanelTrack('Supervisor start') utils.mixpanelTrack('Supervisor start')
@ -95,5 +94,5 @@ knex('config').select('value').where(key: 'uuid').then ([ uuid ]) ->
console.log('Starting connectivity check..') console.log('Starting connectivity check..')
ensureConnected(true) ensureConnected(true)
# Let the previous supervisor know that we started successfully # Tell the supervisor updater that we have successfully started, so that it can do whatever it needs to.
console.log(config.successMessage) supervisor.startupSuccessful()

View File

@ -112,15 +112,9 @@ exports.initialised = currentSupervisor.then (currentSupervisor) ->
stream.on('end', resolve) stream.on('end', resolve)
.then -> .then ->
console.log('Tagging supervisor:', remoteImage) console.log('Inspecting new supervisor:', remoteImage)
docker.getImage(remoteImage).tagAsync(
repo: localImage
force: true
)
.then ->
console.log('Inspecting newly tagged supervisor:', localImage)
Promise.all([ Promise.all([
docker.getImage(localImage).inspectAsync() docker.getImage(remoteImage).inspectAsync()
currentSupervisor currentSupervisor
]) ])
.spread (localImageInfo, currentSupervisor) -> .spread (localImageInfo, currentSupervisor) ->
@ -135,3 +129,13 @@ exports.initialised = currentSupervisor.then (currentSupervisor) ->
# The error here is intentionally not propagated further up the chain, # The error here is intentionally not propagated further up the chain,
# because the supervisor-update module internally handles update failures # because the supervisor-update module internally handles update failures
# and makes sure that ill updates do not affect the rest of the system. # and makes sure that ill updates do not affect the rest of the system.
exports.startupSuccessful = ->
# Let the previous supervisor know that we started successfully
console.log(config.successMessage)
console.log('Tagging ourselves as a working supervisor:', remoteImage)
docker.getImage(remoteImage).tagAsync(
repo: localImage
force: true
)