Ensures we can get multiple endpoints with the same name but different ports. (#1011)
This commit is contained in:
parent
c311c0a221
commit
a756a74b49
@ -60,6 +60,16 @@ def get_by_dnsname(dnsname):
|
||||
return database.get(Endpoint, dnsname, field='dnsname')
|
||||
|
||||
|
||||
def get_by_dnsname_and_port(dnsname, port):
|
||||
"""
|
||||
Retrieves and endpoint by it's dnsname and port.
|
||||
:param dnsname:
|
||||
:param port:
|
||||
:return:
|
||||
"""
|
||||
return Endpoint.query.filter(Endpoint.dnsname == dnsname).filter(Endpoint.port == port).scalar()
|
||||
|
||||
|
||||
def get_by_source(source_label):
|
||||
"""
|
||||
Retrieves all endpoints for a given source.
|
||||
|
@ -109,6 +109,8 @@ def get_elb_endpoints(account_number, region, elb_dict):
|
||||
account_number=account_number, region=region)
|
||||
endpoint['policy'] = format_elb_cipher_policy(policy)
|
||||
|
||||
current_app.logger.debug("Found new endpoint. Endpoint: {}".format(endpoint))
|
||||
|
||||
endpoints.append(endpoint)
|
||||
|
||||
return endpoints
|
||||
|
@ -22,8 +22,6 @@ def sts_client(service, service_type='client'):
|
||||
current_app.config.get('LEMUR_INSTANCE_PROFILE', 'Lemur')
|
||||
)
|
||||
|
||||
current_app.logger.debug('Assuming Role. Role: {0}'.format(arn))
|
||||
|
||||
# TODO add user specific information to RoleSessionName
|
||||
role = sts.assume_role(RoleArn=arn, RoleSessionName='lemur')
|
||||
|
||||
|
@ -72,7 +72,7 @@ def sync_endpoints(source):
|
||||
return new, updated
|
||||
|
||||
for endpoint in endpoints:
|
||||
exists = endpoint_service.get_by_dnsname(endpoint['dnsname'])
|
||||
exists = endpoint_service.get_by_dnsname_and_port(endpoint['dnsname'], endpoint['port'])
|
||||
|
||||
certificate_name = endpoint.pop('certificate_name')
|
||||
|
||||
@ -99,7 +99,7 @@ def sync_endpoints(source):
|
||||
new += 1
|
||||
|
||||
else:
|
||||
current_app.logger.debug("Endpoint Updated: Name: {name}".format(name=endpoint['name']))
|
||||
current_app.logger.debug("Endpoint Updated: {}".format(endpoint))
|
||||
endpoint_service.update(exists.id, **endpoint)
|
||||
updated += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user