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 03ed913 commit 4d6a888
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
64 changes: 32 additions & 32 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.0b68'
VERSION = '1.2.0b69'

# Read Env variables
DEBUG_LOG_LEVEL = os.environ.get('DebugLogLevel', 'INFO')
Expand Down Expand Up @@ -979,38 +979,38 @@ def lambda_handler(
# create CNAME record in private zone
if state == 'running':
try:
# LOGGER.debug("cname_host_name:"
# " %s", str(cname_host_name) + lineno())
# LOGGER.debug("cname_domain_suffix:"
# " %s", str(cname_domain_suffix) + lineno())
# LOGGER.debug("cname_domain_suffix_id:"
# " %s", str(cname_domain_suffix_id) + lineno())
#
create_response = create_resource_record(
route53,
instance_id,
# cname_domain_suffix_id,
# cname_host_name,
# cname_domain_suffix,
cf_zonename_id,
cf_hostname,
cf_zonename,
'CNAME',
final_private_dns_name,
)
append_msg = f"CNAME record in zone id: {cf_zonename_id} owner {phz_collection_by_vpc[cf_zonename_id]['owner_account']} " + \
f"hostname {cf_hostname} in zone {cf_zonename} with value {final_private_dns_name}"
if not flags['nocname']:
LOGGER.debug(f"cname_host_name: {cf_hostname} {lineno()}")
LOGGER.debug(f"cname_domain_suffix: {cf_zonename} {lineno()}")
LOGGER.debug(f"cname_domain_suffix_id: {cf_zonename_id} {lineno()}")
LOGGER.debug(f"cname_target: {final_private_dns_name} {lineno()}")

if create_response == 'success':
dns_data.append(dns_data_tuple(
cf_zonename_id, cf_hostname, cf_zonename, 'CNAME', cf_fqdn))
LOGGER.info(
f"instance: {instance_id}, Created {append_msg} {lineno()}")
caller_response.append('Created ' + append_msg)
else:
caller_response.append(create_response)
caller_response.append('Failed to create ' + append_msg)
LOGGER.error('Failed to create CNAME record: %s', create_response)
create_response = create_resource_record(
route53,
instance_id,
# cname_domain_suffix_id,
# cname_host_name,
# cname_domain_suffix,
cf_zonename_id,
cf_hostname,
cf_zonename,
'CNAME',
final_private_dns_name
)
append_msg = f"CNAME record in zone id: {cf_zonename_id} owner {phz_collection_by_vpc[cf_zonename_id]['owner_account']} " + \
f"hostname {cf_hostname} in zone {cf_zonename} with value {final_private_dns_name}"

if create_response == 'success':
dns_data.append(dns_data_tuple(
cf_zonename_id, cf_hostname, cf_zonename, 'CNAME', cf_fqdn))
LOGGER.info(
f"instance: {instance_id}, Created {append_msg} {lineno()}")
caller_response.append('Created ' + append_msg)
else:
caller_response.append(create_response)
caller_response.append('Failed to create ' + append_msg)
LOGGER.error('Failed to create CNAME record: %s',
create_response)
except BaseException as err:
LOGGER.error("instance: %s, unexpected error. %s\n",
instance_id, str(err) + lineno())
Expand Down
Binary file modified code/ddns-lambda.zip
Binary file not shown.

0 comments on commit 4d6a888

Please sign in to comment.