Skip to content

Commit

Permalink
Return empty set on route53 if no records match
Browse files Browse the repository at this point in the history
  • Loading branch information
josacar committed Mar 11, 2014
1 parent d3c0e30 commit eb31c89
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/fog/aws/requests/dns/list_resource_record_sets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ def list_resource_record_sets(zone_id, options = {})
raise(Excon::Errors.status_error({:expects => 200}, response))
end

if options[:type]
records = zone[:records][options[:type]].values
records = if options[:type]
records = zone[:records][options[:type]]
records.values if records
else
records = zone[:records].values.map{|r| r.values}.flatten
zone[:records].values.map{|r| r.values}.flatten
end

records ||= []

# sort for pagination
records.sort! { |a,b| a[:name].gsub(zone[:name],"") <=> b[:name].gsub(zone[:name],"") }

Expand Down Expand Up @@ -130,4 +133,4 @@ def list_resource_record_sets(zone_id, options = {})
end
end
end
end
end

0 comments on commit eb31c89

Please sign in to comment.