Fix the DB health check

Make sure to search for the proper DB identifier
This commit is contained in:
Joseph Schorr 2015-05-20 17:40:43 -04:00
parent 417c77f4d9
commit e23f1e9ded

View file

@ -77,10 +77,11 @@ class LocalHealthCheck(HealthCheck):
class ProductionHealthCheck(HealthCheck):
def __init__(self, app, access_key, secret_key):
def __init__(self, app, access_key, secret_key, db_instance='quay'):
super(ProductionHealthCheck, self).__init__(app)
self.access_key = access_key
self.secret_key = secret_key
self.db_instance = db_instance
@classmethod
def check_name(cls):
@ -115,7 +116,10 @@ class ProductionHealthCheck(HealthCheck):
aws_access_key_id=self.access_key, aws_secret_access_key=self.secret_key)
response = region.describe_db_instances()['DescribeDBInstancesResponse']
result = response['DescribeDBInstancesResult']
instances = result['DBInstances']
instances = [i for i in result['DBInstances'] if i['DBInstanceIdentifier'] == self.db_instance]
if not instances:
return 'error'
status = instances[0]['DBInstanceStatus']
return status
except: