Move RRSet parsing inside models so that cloudformation works better.
This commit is contained in:
parent
c8bf862826
commit
e47147510b
@ -113,6 +113,16 @@ class FakeZone(object):
|
||||
self.rrsets = []
|
||||
|
||||
def add_rrset(self, record_set):
|
||||
if 'ResourceRecords' in record_set:
|
||||
resource_records = list(record_set['ResourceRecords'].values())[0]
|
||||
if not isinstance(resource_records, list):
|
||||
# Depending on how many records there are, this may or may not be a list
|
||||
resource_records = [resource_records]
|
||||
record_values = [x['Value'] for x in resource_records]
|
||||
elif 'AliasTarget' in record_set:
|
||||
record_values = [record_set['AliasTarget']['DNSName']]
|
||||
record_set['ResourceRecords'] = record_values
|
||||
|
||||
record_set = RecordSet(record_set)
|
||||
self.rrsets.append(record_set)
|
||||
return record_set
|
||||
|
@ -55,15 +55,6 @@ def rrset_response(request, full_url, headers):
|
||||
action = value['Action']
|
||||
record_set = value['ResourceRecordSet']
|
||||
if action == 'CREATE':
|
||||
if 'ResourceRecords' in record_set:
|
||||
resource_records = list(record_set['ResourceRecords'].values())[0]
|
||||
if not isinstance(resource_records, list):
|
||||
# Depending on how many records there are, this may or may not be a list
|
||||
resource_records = [resource_records]
|
||||
record_values = [x['Value'] for x in resource_records]
|
||||
elif 'AliasTarget' in record_set:
|
||||
record_values = [record_set['AliasTarget']['DNSName']]
|
||||
record_set['ResourceRecords'] = record_values
|
||||
the_zone.add_rrset(record_set)
|
||||
elif action == "DELETE":
|
||||
if 'SetIdentifier' in record_set:
|
||||
|
Loading…
Reference in New Issue
Block a user