Revert "Move RRSet parsing inside models so that cloudformation works better."

This reverts commit c7090a2b54.
This commit is contained in:
Steve Pulec 2015-07-14 23:39:06 -04:00 committed by Andrew Harris
parent e47147510b
commit a611010f86
2 changed files with 9 additions and 10 deletions

View File

@ -113,16 +113,6 @@ 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

View File

@ -55,6 +55,15 @@ 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: