1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #870 from mgk/aws-dns-records-nil-options

[aws|dns] fix get, all, and all!
This commit is contained in:
Edward Muller 2012-04-22 12:35:09 -07:00
commit 38d3c33cd8

View file

@ -23,9 +23,10 @@ module Fog
def all(options = {}) def all(options = {})
requires :zone requires :zone
options[:max_items] ||= max_items options[:max_items] ||= max_items
options[:name] ||= name options[:name] ||= zone.domain
options[:type] ||= type options[:type] ||= type
options[:identifier] ||= identifier options[:identifier] ||= identifier
options.delete_if {|key, value| value.nil?}
data = connection.list_resource_record_sets(zone.id, options).body data = connection.list_resource_record_sets(zone.id, options).body
# NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks.
@ -49,6 +50,8 @@ module Fog
:type => next_record_type, :type => next_record_type,
:identifier => next_record_identifier :identifier => next_record_identifier
} }
options.delete_if {|key, value| value.nil?}
batch = connection.list_resource_record_sets(zone.id, options).body batch = connection.list_resource_record_sets(zone.id, options).body
# NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks.
batch['NextRecordIdentifier'] = nil unless batch.has_key?('NextRecordIdentifier') batch['NextRecordIdentifier'] = nil unless batch.has_key?('NextRecordIdentifier')
@ -82,6 +85,7 @@ module Fog
:type => record_type, :type => record_type,
:identifier => record_identifier :identifier => record_identifier
} }
options.delete_if {|key, value| value.nil?}
data = connection.list_resource_record_sets(zone.id, options).body data = connection.list_resource_record_sets(zone.id, options).body
# Get first record # Get first record