R53: Extend only TXT records
This commit is contained in:
parent
3efc709e03
commit
3397fb6560
|
@ -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)):
|
||||||
|
|
Loading…
Reference in New Issue