diff --git a/code/ddns-lambda.py b/code/ddns-lambda.py index 3219d09..be7ca7a 100755 --- a/code/ddns-lambda.py +++ b/code/ddns-lambda.py @@ -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') @@ -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) @@ -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'] @@ -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']: