Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 26, 2023
1 parent 3605d43 commit 8bc82bf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 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.0b52'
VERSION = '1.2.0b53'

# Read Env variables
DEBUG_LOG_LEVEL = os.environ.get('DebugLogLevel', 'INFO')
Expand Down Expand Up @@ -302,6 +302,9 @@ def lambda_handler(
LOGGER.info("context: %s", str(context) + lineno())
LOGGER.info("Sns Topic Mode: %s, sending to %s", str(SNS_ENABLE), SNS_TOPIC_ARN)

dns_data_fields = ['zone_id', 'rr_name', 'zone_name', 'rr_type', 'rr_value']
dns_data_tuple = namedtuple('DnsData', dns_data_fields)

caller_response = []
# Checking to make sure there is a dynamodb table named in the Env Variable
tables = list_tables(dynamodb_client)
Expand Down Expand Up @@ -394,6 +397,11 @@ def lambda_handler(
instance = get_item_from_dynamodb_table(dynamodb_client, DDBNAME, instance_id)
LOGGER.info("instance attributes: %s", str(instance) + lineno())

# LOGGER.info(f"Fetching instance DNS information from dynamodb {lineno()}")
# instance_dns_data = get_item_from_dynamodb_table(dynamodb_client, DDBNAME, f'{instance_id}/dns')
# instance_dns_data_dict = json.loads(instance_dns_data, default=json_serial)
# LOGGER.info(f"instance dns data: {str(instance_dns_data)} length {len(instance_dns_data_dict)} {lineno()}")

# Get the instance tags and reorder them because we want a zone created before CNAME
try:
tags = instance['Reservations'][0]['Instances'][0]['Tags']
Expand Down Expand Up @@ -719,10 +727,7 @@ def lambda_handler(
" %s", str(heritage_value) + lineno())
delete_records = True

dns_data_fields = ['zone_id', 'rr_name', 'zone_name', 'rr_type', 'rr_value']
dns_data_tuple = namedtuple('DnsData', dns_data_fields)
dns_data = []

# Create OR Delete the A / PTR Record
if state == 'running':
if not flags['noforward']:
Expand Down

0 comments on commit 8bc82bf

Please sign in to comment.