mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
as requested, fix the style errors at https://jenkins.saltstack.com/job/salt-pr-lint-n/8272/violations/file/salt/modules/boto_route53.py/
This commit is contained in:
parent
394c6655e9
commit
861e31a110
@ -117,13 +117,13 @@ def zone_exists(zone, region=None, key=None, keyid=None, profile=None,
|
|||||||
try:
|
try:
|
||||||
return bool(conn.get_zone(zone))
|
return bool(conn.get_zone(zone))
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
@ -213,15 +213,15 @@ def get_record(name, zone, record_type, fetch_all=False, region=None, key=None,
|
|||||||
else:
|
else:
|
||||||
_record = _zone.find_records(name, _type, all=fetch_all)
|
_record = _zone.find_records(name, _type, all=fetch_all)
|
||||||
|
|
||||||
break # the while True
|
break # the while True
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
if _record:
|
if _record:
|
||||||
@ -259,13 +259,13 @@ def add_record(name, value, zone, record_type, identifier=None, ttl=None,
|
|||||||
_type = record_type.upper()
|
_type = record_type.upper()
|
||||||
break
|
break
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
while rate_limit_retries > 0:
|
while rate_limit_retries > 0:
|
||||||
@ -286,15 +286,16 @@ def add_record(name, value, zone, record_type, identifier=None, ttl=None,
|
|||||||
status = _zone.add_record(_type, name, value, ttl, identifier)
|
status = _zone.add_record(_type, name, value, ttl, identifier)
|
||||||
return _wait_for_sync(status.id, conn, wait_for_sync)
|
return _wait_for_sync(status.id, conn, wait_for_sync)
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def update_record(name, value, zone, record_type, identifier=None, ttl=None,
|
def update_record(name, value, zone, record_type, identifier=None, ttl=None,
|
||||||
region=None, key=None, keyid=None, profile=None,
|
region=None, key=None, keyid=None, profile=None,
|
||||||
wait_for_sync=True, split_dns=False, private_zone=False,
|
wait_for_sync=True, split_dns=False, private_zone=False,
|
||||||
@ -336,13 +337,13 @@ def update_record(name, value, zone, record_type, identifier=None, ttl=None,
|
|||||||
status = _zone.update_record(old_record, value, ttl, identifier)
|
status = _zone.update_record(old_record, value, ttl, identifier)
|
||||||
return _wait_for_sync(status.id, conn, wait_for_sync)
|
return _wait_for_sync(status.id, conn, wait_for_sync)
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
@ -387,15 +388,16 @@ def delete_record(name, zone, record_type, identifier=None, all_records=False,
|
|||||||
status = _zone.delete_record(old_record)
|
status = _zone.delete_record(old_record)
|
||||||
return _wait_for_sync(status.id, conn, wait_for_sync)
|
return _wait_for_sync(status.id, conn, wait_for_sync)
|
||||||
|
|
||||||
except DNSServerError, e:
|
except DNSServerError as e:
|
||||||
# if rate limit, retry:
|
# if rate limit, retry:
|
||||||
if retry_on_rate_limit and 'Throttling' == e.code:
|
if retry_on_rate_limit and 'Throttling' == e.code:
|
||||||
log.debug('Throttled by AWS API.')
|
log.debug('Throttled by AWS API.')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
rate_limit_retries -= 1
|
rate_limit_retries -= 1
|
||||||
continue # the while True; try again if not out of retries
|
continue # the while True; try again if not out of retries
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def _wait_for_sync(status, conn, wait_for_sync):
|
def _wait_for_sync(status, conn, wait_for_sync):
|
||||||
if not wait_for_sync:
|
if not wait_for_sync:
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user