Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 26, 2023
1 parent b63ae9d commit 48a6614
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions code/ddns-lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ def lambda_handler(

LOGGER.debug("iterating through tags %s", lineno())

tags_dict = tags_to_dict(tags)
flags = process_tags_flags(tags)
LOGGER.debug("New flags structure: %s", str(pformat(flags)) + lineno())
LOGGER.info("Options flags: " + ' '.join([f"{x}={flags[x]}" for x in flags]))
Expand Down Expand Up @@ -2960,6 +2961,18 @@ def process_delete_records(route53, instance_id, zone_id,
return response


def tags_to_dict(tags):
"""
Process all tag key/value pairs into a dict
:param list(dict(string)) tags: tags from instance, list of dict of string
:return dict(string): flag settings in defaultdict for controlling which names are registered and when
"""

tag_dict = {tag['Key'].lstrip().rstrip(): tag['Value'] for tag in tags}
return tag_dict


def process_tags_flags(tags):
"""
Process the DNS flags tags into for tags[key]=='boc:dns:flags'
Expand All @@ -2978,8 +2991,6 @@ def process_tags_flags(tags):

return flags_dict

# TAGKEY_CNAME = os.environ.get('TagKeyCname', 'boc:dns:cname')


def process_tags_value(name):
"""
Expand Down Expand Up @@ -3131,20 +3142,23 @@ def create_fqdn(host, zone):
fqdn += '.' if fqdn[-1] != '.' else ''
return fqdn


aws: elasticmapreduce: job - flow - id        j - 8O514K6HPIYZ
A2      GenerateCertificate     FALSE
A2      Webhook 1680546860
A2      StackName       DAS - REL - groupii - dashboard - integration - docim
A2      CAMPAIGN_NAME   ashen
A2      DontPatch       true
A2      ProjectNumber   fs0000000033
A2      NoBootstrap     FALSE
A2      RunConfiguration        NMFv73State
A2      ClusterSize     Small2
A2      FRIENDLY_NAME   docim
A2      CloudWatchEnable        FALSE
A2      ModeOfOperation MODE2: Run Group II Safetab P
A2      LightsOut       true
A2      POC     Ryan Kane
A2      aws: elasticmapreduce: instance - group - role        MASTER
##
# aws: elasticmapreduce: job - flow - id        j - 8O514K6HPIYZ
# A2      GenerateCertificate     FALSE
# A2      Webhook 1680546860
# A2      StackName       DAS - REL - groupii - dashboard - integration - docim
# A2      CAMPAIGN_NAME   ashen
# A2      DontPatch       true
# A2      ProjectNumber   fs0000000033
# A2      NoBootstrap     FALSE
# A2      RunConfiguration        NMFv73State
# A2      ClusterSize     Small2
# A2      FRIENDLY_NAME   docim
# A2      CloudWatchEnable        FALSE
# A2      ModeOfOperation MODE2: Run Group II Safetab P
# A2      LightsOut       true
# A2      POC     Ryan Kane
# A2      aws: elasticmapreduce: instance - group - role        MASTER

# aws: elasticmapreduce: job - flow - id        j - 8O514K6HPIYZ
# A2      aws: elasticmapreduce: instance - group - role        MASTER
Binary file modified code/ddns-lambda.zip
Binary file not shown.

0 comments on commit 48a6614

Please sign in to comment.