From 2edb3148d0824b4a764c0657e74299c5bd1324a9 Mon Sep 17 00:00:00 2001 From: badra001 Date: Fri, 25 Feb 2022 11:37:40 -0500 Subject: [PATCH] fix --- code/ddns-lambda.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/code/ddns-lambda.py b/code/ddns-lambda.py index b04e4fe..069122d 100755 --- a/code/ddns-lambda.py +++ b/code/ddns-lambda.py @@ -67,13 +67,12 @@ from botocore.exceptions import ClientError from collections import OrderedDict from pprint import pformat -from dateutil.parser import parse as date_parse # Setting Global Variables LOGGER = logging.getLogger() ACCOUNT = None REGION = None -VERSION = '0.1.14' +VERSION = '0.1.15' # Adjust the logging level [logging.INFO, logging.DEBUG, logging.WARNING, etc] LOGGER.setLevel(logging.DEBUG) @@ -272,14 +271,13 @@ def lambda_handler( try: private_ip = instance['Reservations'][0]['Instances'][0]['PrivateIpAddress'] launch_time = instance['Reservations'][0]['Instances'][0]['LaunchTime'] - launch_time_date = date_parse(launch_time) 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("launch time: %s", str(launch_time) + lineno()) - LOGGER.debug("launch time_date: %s", str( - int(launch_time_date.timestamp())) + lineno()) + LOGGER.debug("launch time timestamp: %s", str( + int(launch_time.timestamp())) + lineno()) LOGGER.debug("private_dns_name: %s", str(private_dns_name) + lineno()) LOGGER.debug("private_host_name: %s", str(private_host_name) + lineno()) except: @@ -629,7 +627,7 @@ def lambda_handler( 'instance_id': instance_id, }) add_heritage_item_timestamp(heritage, 'create_time', - int(launch_time_date.timestamp())) + int(launch_time.timestamp())) heritage_value = format_heritage(heritage) heritage_value = '"{}"'.format(heritage_value) if len( heritage_value) else heritage_value