Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Feb 25, 2022
1 parent d080dcc commit 70bbe6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions code/ddns-lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@
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.15'
VERSION = '0.1.16'

# Adjust the logging level [logging.INFO, logging.DEBUG, logging.WARNING, etc]
LOGGER.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -271,13 +272,14 @@ 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(str(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 timestamp: %s", str(
int(launch_time.timestamp())) + lineno())
int(launch_time_date.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:
Expand Down Expand Up @@ -627,7 +629,7 @@ def lambda_handler(
'instance_id': instance_id,
})
add_heritage_item_timestamp(heritage, 'create_time',
int(launch_time.timestamp()))
int(launch_time_date.timestamp()))
heritage_value = format_heritage(heritage)
heritage_value = '"{}"'.format(heritage_value) if len(
heritage_value) else heritage_value
Expand Down

0 comments on commit 70bbe6c

Please sign in to comment.