Fix exception handling in the registry health check and make sure the user_loader is registered before the process is forked

This commit is contained in:
Joseph Schorr 2015-01-16 22:41:54 -05:00
parent e7054a8690
commit 2a89accc49
4 changed files with 58 additions and 43 deletions

View file

@ -27,6 +27,9 @@ import features
logger = logging.getLogger(__name__)
# Capture the unverified SSL errors.
logging.captureWarnings(True)
web = Blueprint('web', __name__)
STATUS_TAGS = app.config['STATUS_TAGS']
@ -167,7 +170,11 @@ def health():
port = ':' + hostname_parts[1]
registry_url = '%s://localhost%s/v1/_internal_ping' % (app.config['PREFERRED_URL_SCHEME'], port)
registry_healthy = client.get(registry_url, verify=False, timeout=2).status_code == 200
registry_healthy = False
try:
registry_healthy = client.get(registry_url, verify=False, timeout=2).status_code == 200
except Exception:
logger.exception('Exception when checking registry health: %s', registry_url)
check = HealthCheck.get_check(app.config['HEALTH_CHECKER'][0], app.config['HEALTH_CHECKER'][1])
(data, is_healthy) = check.conduct_healthcheck(db_healthy, buildlogs_healthy, registry_healthy)