Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 27, 2023
1 parent 1f6a02a commit 3b7faa8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions code/ddns-lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,34 +1673,37 @@ def new_change_resource_recordset(oclient, instance_id, zone_id, host_name, host
# f"exception: {instance_id} err {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
except Route53.Client.exceptions.NoSuchHostedZone as err:


# if 'NoSuchHostedZone' in str(err) and 'No hosted zone found with ID' in str(err):
3 LOGGER.error("Hosted zone not found error: %s", str(err) + lineno())
LOGGER.info(
f"exception: NoSuchHostedZone {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "NoSuchHostedZone"
break
# if 'NoSuchHostedZone' in str(err) and 'No hosted zone found with ID' in str(err):
# LOGGER.error("Hosted zone not found error: %s", str(err) + lineno())
LOGGER.info(
f"exception: NoSuchHostedZone {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "NoSuchHostedZone"
break
except Route53.Client.exceptions.InvalidChangeBatch as err:
# elif 'InvalidChangeBatch' in str(err) and 'is not permitted in zone' in str(err):
# LOGGER.error(
# "Cannot create record - most likely wrong zone name specified: %s", str(err) + lineno())
# update_response = "InvalidChangeBatch-WrongZoneName"
LOGGER.info(f"exception: InvalidChangeBatch {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "InvalidChangeBatch"
break
# elif 'InvalidChangeBatch' in str(err) and 'is not permitted in zone' in str(err):
# LOGGER.error(
# "Cannot create record - most likely wrong zone name specified: %s", str(err) + lineno())
# update_response = "InvalidChangeBatch-WrongZoneName"
LOGGER.info(
f"exception: InvalidChangeBatch {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "InvalidChangeBatch"
break
except Route53.Client.exceptions.InvalidInput as err:
LOGGER.info(f"exception: InvalidInput {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "InvalidInput"
break
LOGGER.info(
f"exception: InvalidInput {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
update_response = "InvalidInput"
break
except Route53.Client.exceptions.PriorRequestNotComplete as err:
# elif "(Throttling)" in str(err):
LOGGER.info(f"exception: PriorRequestNotComplete {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
# elif "(Throttling)" in str(err):
LOGGER.info(
f"exception: PriorRequestNotComplete {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
# LOGGER.debug("change_resource_record_sets UPSERT throttled due to API limit, retrying: %s", str(err) + lineno())
# else:
# LOGGER.info(
# f"instance: {instance_id} unexpected error: {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
except Exception as err:
LOGGER.info(f"exception: Exception {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")
LOGGER.info(
f"exception: Exception {err} sys.exc_info {sys.exc_info()[0]} {sys.exc_info()[1]} {lineno()}")

i += 1
LOGGER.info("instance: %s, change_resource_record_sets UPSERT returned error, waiting before retry. %s",
Expand All @@ -1710,8 +1713,6 @@ def new_change_resource_recordset(oclient, instance_id, zone_id, host_name, host
count['sleep.time'] += i
count['retry'] += 1



if i >= MAX_API_RETRY:
LOGGER.error("instance: %s, change_resource_record_sets exceeded max retry of %s",
instance_id, str(MAX_API_RETRY) + lineno())
Expand Down
Binary file modified code/ddns-lambda.zip
Binary file not shown.

0 comments on commit 3b7faa8

Please sign in to comment.