diff --git a/code/ddns-lambda.py b/code/ddns-lambda.py index cd32eb8..8ac0262 100755 --- a/code/ddns-lambda.py +++ b/code/ddns-lambda.py @@ -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])) @@ -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' @@ -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): """ @@ -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 diff --git a/code/ddns-lambda.zip b/code/ddns-lambda.zip index 0c94b2f..76c92c2 100644 Binary files a/code/ddns-lambda.zip and b/code/ddns-lambda.zip differ