IPResolver: fix unreachable code (#3267)

* Fix unreachable code

_get_aws_ip_ranges handles missing file exceptions and returns None,
so the excepttion handling block in the UpdateIPRange thread is never reached.

* Test for missing range file in resolver thread
This commit is contained in:
Kenny Lee Sin Cheong 2018-10-12 10:24:28 -04:00 committed by GitHub
parent 0f1d415c49
commit fc67bbd0a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View file

@ -211,10 +211,9 @@ class _UpdateIPRange(Thread):
def run(self):
while True:
try:
logger.debug('Updating aws ip range from "%s"', 'util/ipresolver/aws-ip-ranges.json')
aws_ip_range_json = _get_aws_ip_ranges()
except:
logger.debug('Updating aws ip range from "%s"', 'util/ipresolver/aws-ip-ranges.json')
aws_ip_range_json = _get_aws_ip_ranges()
if aws_ip_range_json is None:
logger.exception('Failed trying to update aws ip range')
time.sleep(_FAILED_UPDATE_RETRY_SECS)
continue