yapf
This commit is contained in:
parent
4853634c2f
commit
7b1dfbb256
4 changed files with 14 additions and 8 deletions
|
@ -4,6 +4,7 @@ from health.services import check_all_services
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_healthchecker(app, config_provider, instance_keys):
|
||||
""" Returns a HealthCheck instance for the given app. """
|
||||
return HealthCheck.get_checker(app, config_provider, instance_keys)
|
||||
|
@ -62,7 +63,6 @@ class HealthCheck(object):
|
|||
|
||||
return (data, 200 if is_healthy else 503)
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_checker(cls, app, config_provider, instance_keys):
|
||||
name = app.config['HEALTH_CHECKER'][0]
|
||||
|
@ -77,8 +77,8 @@ class HealthCheck(object):
|
|||
|
||||
class LocalHealthCheck(HealthCheck):
|
||||
def __init__(self, app, config_provider, instance_keys):
|
||||
super(LocalHealthCheck, self).__init__(app, config_provider, instance_keys,
|
||||
['redis', 'storage'])
|
||||
super(LocalHealthCheck, self).__init__(app, config_provider, instance_keys, [
|
||||
'redis', 'storage'])
|
||||
|
||||
@classmethod
|
||||
def check_names(cls):
|
||||
|
@ -88,8 +88,8 @@ class LocalHealthCheck(HealthCheck):
|
|||
class RDSAwareHealthCheck(HealthCheck):
|
||||
def __init__(self, app, config_provider, instance_keys, access_key, secret_key,
|
||||
db_instance='quay', region='us-east-1'):
|
||||
super(RDSAwareHealthCheck, self).__init__(app, config_provider, instance_keys,
|
||||
['redis', 'storage'])
|
||||
super(RDSAwareHealthCheck, self).__init__(app, config_provider, instance_keys, [
|
||||
'redis', 'storage'])
|
||||
|
||||
self.access_key = access_key
|
||||
self.secret_key = secret_key
|
||||
|
@ -121,7 +121,6 @@ class RDSAwareHealthCheck(HealthCheck):
|
|||
|
||||
return self.calculate_overall_health(service_statuses, skip=skip, notes=notes)
|
||||
|
||||
|
||||
def _get_rds_status(self):
|
||||
""" Returns the status of the RDS instance as reported by AWS. """
|
||||
try:
|
||||
|
@ -130,7 +129,8 @@ class RDSAwareHealthCheck(HealthCheck):
|
|||
|
||||
response = region.describe_db_instances()['DescribeDBInstancesResponse']
|
||||
result = response['DescribeDBInstancesResult']
|
||||
instances = [i for i in result['DBInstances'] if i['DBInstanceIdentifier'] == self.db_instance]
|
||||
instances = [
|
||||
i for i in result['DBInstances'] if i['DBInstanceIdentifier'] == self.db_instance]
|
||||
if not instances:
|
||||
return 'error'
|
||||
|
||||
|
|
Reference in a new issue