Merge pull request #1372 from castrapel/acme_validation_dns_provider_option

R53: Extend only TXT records
This commit is contained in:
Curtis 2018-06-20 10:50:15 -07:00 committed by GitHub
commit c0c6ff51e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -35,11 +35,15 @@ def find_zone_id(domain, client=None):
def change_txt_record(action, zone_id, domain, value, client=None): def change_txt_record(action, zone_id, domain, value, client=None):
current_txt_records = [] current_txt_records = []
try: try:
current_txt_records = client.list_resource_record_sets( current_records = client.list_resource_record_sets(
HostedZoneId=zone_id, HostedZoneId=zone_id,
StartRecordName=domain, StartRecordName=domain,
StartRecordType='TXT', StartRecordType='TXT',
MaxItems="1")["ResourceRecordSets"][0]["ResourceRecords"] MaxItems="1")["ResourceRecordSets"]
for record in current_records:
if record.get('Type') == 'TXT':
current_txt_records.extend(record.get("ResourceRecords", []))
except Exception as e: except Exception as e:
# Current Resource Record does not exist # Current Resource Record does not exist
if "NoSuchHostedZone" not in str(type(e)): if "NoSuchHostedZone" not in str(type(e)):