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 2ce97bf commit 03ed913
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
11 changes: 9 additions & 2 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.0b67'
VERSION = '1.2.0b68'

# Read Env variables
DEBUG_LOG_LEVEL = os.environ.get('DebugLogLevel', 'INFO')
Expand Down Expand Up @@ -904,20 +904,27 @@ def lambda_handler(

# else: # not running so delete the records. Note this may leave orphans around if the flags are set and then the host is shut down. We may want to remove no matter what.
# go through the dns_data records, and delete them. dns_data contains the records that were added. It is possible the tags have changed
# so using existing tag data will not be valid
# so using existing tag data will not be valid. nodelete_dns_data is written back to the ddb if there are entries which did not get removed

if state != 'running':
heritage_records = {}
o_dns_data = dns_data.copy()
nodelete_dns_data = []
for entry in dns_data:
if entry.rr_type == 'TXT' and "heritage=" in entry.rr_value:
heritage_records[entry.rr_name] = entry.rr_value
p_delete = True
for entry in dns_data:
if not (entry.rr_type == 'TXT' and "heritage=" in entry.rr_value):
process_response = new_process_delete_records(
instance_id, entry.zone_id, entry.rr_name, entry.zone_name, entry.rr_type, entry.rr_value, heritage_records.get(entry.rr_name, ''))
delete_records = delete_records and process_response['delete_success']
caller_response = caller_response + process_response['msg']
count[f"delete_success.{process_response.get('delete_success')}"] += 1
p_delete = process_response['delete_success']
if not p_delete:
nodelete_dns_data.append(entry)
dns_data = nodelete_dns_data

# # Process and delete A record and associated TXT record
# process_response = process_delete_records(
Expand Down
Binary file modified code/ddns-lambda.zip
Binary file not shown.

0 comments on commit 03ed913

Please sign in to comment.