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 3a547b6 commit 5a50b95
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions code/ddns-lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
LOGGER = logging.getLogger()
account_id = None
region = None
VERSION = '1.2.0b76'
VERSION = '1.2.0b77'

# Read Env variables
DEBUG_LOG_LEVEL = os.environ.get('DebugLogLevel', 'INFO')
Expand Down Expand Up @@ -416,17 +416,20 @@ def lambda_handler(
LOGGER.info("Fetching instance information from dynamodb %s", lineno())
instance = get_item_from_dynamodb_table(dynamodb_client, DDBNAME, instance_id)
LOGGER.info("instance attributes: %s", str(instance) + lineno())
try:
dns_data_raw = instance.get('_DnsEntries', [])
LOGGER.debug(
f"got _DnsEntries type {type(dns_data_raw)} value {dns_data_raw} {lineno()}")
dns_data = [dns_data_tuple(**item) for item in dns_data_raw]
LOGGER.debug(f"converted _DnsEntries to namdtuples {dns_data} {lineno()}")
LOGGER.info(
f"Found entries from DDB for DNS records: {str(dns_data)} {lineno()}")
except Exception as err:
LOGGER.error(f"Cannot deserialize instance data from DDB: {err} {lineno()}")
dns_data = []
dns_data = []
if len(instance) > 0:
try:
dns_data_raw = instance.get('_DnsEntries', [])
LOGGER.debug(
f"got _DnsEntries type {type(dns_data_raw)} value {dns_data_raw} {lineno()}")
dns_data = [dns_data_tuple(**item) for item in dns_data_raw]
LOGGER.debug(
f"converted _DnsEntries to namdtuples {dns_data} {lineno()}")
LOGGER.info(
f"Found entries from DDB for DNS records: {str(dns_data)} {lineno()}")
except Exception as err:
LOGGER.error(
f"Cannot deserialize instance data from DDB: {err} {lineno()}")

# Get the instance tags and reorder them because we want a zone created before CNAME
try:
Expand Down
Binary file modified code/ddns-lambda.zip
Binary file not shown.

0 comments on commit 5a50b95

Please sign in to comment.