The SUPERVISOR_IMAGE is now the fully qualified image (since it can be on another registry) - update to work with this and stop attempting to delete the actual supervisor image.

This commit is contained in:
Pagan Gazzard 2015-02-16 20:49:43 +00:00 committed by Pablo Carranza Vélez
parent 5b7fa87cd6
commit 3d83c03868
2 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,7 @@ module.exports = config =
publish_key: process.env.PUBNUB_PUBLISH_KEY ? 'pub-c-bananas'
mixpanelToken: process.env.MIXPANEL_TOKEN ? 'bananasbananas'
dockerSocket: process.env.DOCKER_SOCKET ? '/run/docker.sock'
localImage: process.env.SUPERVISOR_IMAGE ? 'resin/rpi-supervisor'
supervisorImage: process.env.SUPERVISOR_IMAGE ? 'resin/rpi-supervisor'
configMountPoint: process.env.CONFIG_MOUNT_POINT ? '/mnt/mmcblk0p1/config.json'
ledFile: process.env.LED_FILE ? '/sys/class/leds/led0/brightness'
bootstrapRetryDelay: checkInt(process.env.BOOTSTRAP_RETRY_DELAY_MS) ? 30000
@ -26,8 +26,6 @@ module.exports = config =
config.heartbeatEndpoint = config.apiEndpoint + '/ping'
config.remoteImage = config.registryEndpoint + '/' + config.localImage
config.supervisorContainer =
Volumes:
'/boot/config.json': {}

View File

@ -55,7 +55,10 @@ do ->
.finally ->
imagesBeingFetched--
supervisorImages = [ "#{config.localImage}:latest", "#{config.remoteImage}:latest" ]
supervisorImage = config.supervisorImage
if !/:/g.test(supervisorImage)
# If there is no tag then mark it as latest
supervisorImage += ':latest'
exports.cleanupContainersAndImages = ->
knex('app').select()
.map (app) ->
@ -67,7 +70,7 @@ do ->
# Do not remove user apps.
if _.contains(apps, containerInfo.Image)
return false
if !_.contains(supervisorImages, containerInfo.Image)
if containerInfo.Image isnt supervisorImage
return true
return containerHasExited(containerInfo.Id)
.map (containerInfo) ->
@ -82,7 +85,7 @@ do ->
docker.listImagesAsync()
.filter (image) ->
!_.any image.RepoTags, (imageId) ->
_.contains(apps, imageId) or _.contains(supervisorImages, imageId)
supervisorImage is imageId or _.contains(apps, imageId)
.map (image) ->
docker.getImage(image.Id).removeAsync()
.then ->