From eb93a2bcd1db7992538b7560e27450820a31d1f7 Mon Sep 17 00:00:00 2001 From: Vincent Rivellino Date: Fri, 24 Jan 2014 14:34:53 -0500 Subject: [PATCH] Route53 Zone.update_record() fix [spulec/moto#83] * Zone.update_record() issues what is essentially a batched update to the AWS Route53 API: It's a DELETE followed by a CREATE. This fix allow moto to handle that batched update. --- moto/route53/responses.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moto/route53/responses.py b/moto/route53/responses.py index 55160922e..50fe79b5e 100644 --- a/moto/route53/responses.py +++ b/moto/route53/responses.py @@ -45,7 +45,12 @@ def rrset_response(request, full_url, headers): if method == "POST": elements = xmltodict.parse(request.body) - for key, value in elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes'].items(): + + change_list = elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes']['Change'] + if not isinstance(change_list, list): + change_list = [elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes']['Change']] + + for value in change_list: action = value['Action'] rrset = value['ResourceRecordSet']