Route53 get_record_sets: filter type after name

According to the documentation [1], name should be filtered first,
followed by type.

> If you specify both Name and Type
> The results begin with the first resource record set in the list
> whose name is greater than or equal to Name, and whose type is
> greater than or equal to Type.

[1]: https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListResourceRecordSets.html
This commit is contained in:
Niels Laukens 2019-06-14 16:15:14 +02:00
parent df493ea18d
commit a9319fad04
No known key found for this signature in database
GPG Key ID: D1397B5A6435A6D8

View File

@ -200,12 +200,12 @@ class FakeZone(BaseModel):
def get_record_sets(self, start_type, start_name): def get_record_sets(self, start_type, start_name):
record_sets = list(self.rrsets) # Copy the list record_sets = list(self.rrsets) # Copy the list
if start_type:
record_sets = [
record_set for record_set in record_sets if record_set.type_ >= start_type]
if start_name: if start_name:
record_sets = [ record_sets = [
record_set for record_set in record_sets if record_set.name >= start_name] record_set for record_set in record_sets if record_set.name >= start_name]
if start_type:
record_sets = [
record_set for record_set in record_sets if record_set.type_ >= start_type]
return record_sets return record_sets