Merge remote-tracking branch 'upstream/master' into python-registry-v2

This commit is contained in:
Jake Moshenko 2015-10-26 14:44:16 -04:00
commit 2c10d28afc
13 changed files with 57 additions and 36 deletions

View file

@ -18,7 +18,11 @@ class RedisBuildLogs(object):
PHASE = 'phase'
def __init__(self, redis_config):
self._redis = redis.StrictRedis(socket_connect_timeout=5, **redis_config)
args = dict(redis_config)
args.update({'socket_connect_timeout': 5})
self._redis_config = redis_config
self._redis = redis.StrictRedis(**args)
@staticmethod
def _logs_key(build_id):
@ -94,12 +98,16 @@ class RedisBuildLogs(object):
def check_health(self):
try:
if not self._redis.ping() == True:
args = dict(self._redis_config)
args.update({'socket_connect_timeout': 1, 'socket_timeout': 1})
connection = redis.StrictRedis(**args)
if not connection.ping() == True:
return False
# Ensure we can write and read a key.
self._redis.set(self._health_key(), time.time())
self._redis.get(self._health_key())
connection.set(self._health_key(), time.time())
connection.get(self._health_key())
return True
except redis.ConnectionError:

View file

@ -17,8 +17,8 @@ from util.migrate.backfill_v1_metadata import backfill_v1_metadata
def upgrade(tables):
backfill_image_fields()
backfill_v1_metadata()
backfill_image_fields()
backfill_v1_metadata()
def downgrade(tables):
pass
pass

View file

@ -199,6 +199,7 @@ def _find_or_link_image(existing_image, repo_obj, username, translations, prefer
command=existing_image.command,
created=existing_image.created,
comment=existing_image.comment,
v1_json_metadata=existing_image.v1_json_metadata,
aggregate_size=existing_image.aggregate_size)