diff --git a/CHANGELOG.md b/CHANGELOG.md index 5987854..cb8c9f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,3 +37,8 @@ * 0.0.23 -- 2022-02-22 - code 0.1.0 - add heritage TXT record support + +* 0.1.0 -- 2022-02-24 + - code 0.1.11 + - lots of bug fixes + - incorporate actual adding of heritage text records diff --git a/code/ddns-lambda.py b/code/ddns-lambda.py index 951d72f..6bbeb13 100755 --- a/code/ddns-lambda.py +++ b/code/ddns-lambda.py @@ -73,7 +73,7 @@ LOGGER = logging.getLogger() ACCOUNT = None REGION = None -VERSION = '0.1.10' +VERSION = '0.1.11' # Adjust the logging level [logging.INFO, logging.DEBUG, logging.WARNING, etc] LOGGER.setLevel(logging.DEBUG) @@ -264,14 +264,23 @@ def lambda_handler( instance['Reservations'][0]['Instances']) + lineno()) LOGGER.debug("reservations:" " %s", str(instance['Reservations'][0]['Instances'][0]) + lineno()) + elif instance is None: + caller_response.append( + 'No instance {} found for event state {}. Exiting script.'.format(instance_id, state)) + return caller_response - private_ip = instance['Reservations'][0]['Instances'][0]['PrivateIpAddress'] - private_dns_name = instance['Reservations'][0]['Instances'][0]['PrivateDnsName'] - private_host_name = private_dns_name.split('.')[0] + try: + private_ip = instance['Reservations'][0]['Instances'][0]['PrivateIpAddress'] + private_dns_name = instance['Reservations'][0]['Instances'][0]['PrivateDnsName'] + private_host_name = private_dns_name.split('.')[0] - LOGGER.debug("private ip: %s", str(private_ip) + lineno()) - LOGGER.debug("private_dns_name: %s", str(private_dns_name) + lineno()) - LOGGER.debug("private_host_name: %s", str(private_host_name) + lineno()) + LOGGER.debug("private ip: %s", str(private_ip) + lineno()) + LOGGER.debug("private_dns_name: %s", str(private_dns_name) + lineno()) + LOGGER.debug("private_host_name: %s", str(private_host_name) + lineno()) + except: + caller_response.append( + 'Unable to extract IP Address or DNS name from instance {} for state {}. Exiting script.'.format(instance_id, state)) + return caller_response # Get the subnet mask of the instance subnet_id = instance['Reservations'][0]['Instances'][0]['SubnetId'] diff --git a/code/ddns-lambda.zip b/code/ddns-lambda.zip index 5901708..1fe6566 100644 Binary files a/code/ddns-lambda.zip and b/code/ddns-lambda.zip differ diff --git a/version.tf b/version.tf index 4c5fed3..b12b2f6 100644 --- a/version.tf +++ b/version.tf @@ -1,3 +1,3 @@ locals { - _module_version = "0.0.23" + _module_version = "0.1.0" }