From 298522644c0ed34995be6aaf48989d8a3a9d2591 Mon Sep 17 00:00:00 2001 From: Michael Keirnan Date: Sat, 21 Apr 2012 14:34:09 -0400 Subject: [PATCH] fix get, all, and all! get and all returned AWS error responses about empty values being specified. Existing shin do tests already covered these cases as this: FOG_MOCK=false bundle exec shindont tests/aws/models/dns/records_tests.rb was reporting 6 failures. Tests pass after fix. --- lib/fog/aws/models/dns/records.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/models/dns/records.rb b/lib/fog/aws/models/dns/records.rb index f9c041acf..2bc5fb5f1 100644 --- a/lib/fog/aws/models/dns/records.rb +++ b/lib/fog/aws/models/dns/records.rb @@ -23,9 +23,10 @@ module Fog def all(options = {}) requires :zone options[:max_items] ||= max_items - options[:name] ||= name + options[:name] ||= zone.domain options[:type] ||= type options[:identifier] ||= identifier + options.delete_if {|key, value| value.nil?} data = connection.list_resource_record_sets(zone.id, options).body # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. @@ -49,6 +50,8 @@ module Fog :type => next_record_type, :identifier => next_record_identifier } + options.delete_if {|key, value| value.nil?} + batch = connection.list_resource_record_sets(zone.id, options).body # NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks. batch['NextRecordIdentifier'] = nil unless batch.has_key?('NextRecordIdentifier') @@ -82,6 +85,7 @@ module Fog :type => record_type, :identifier => record_identifier } + options.delete_if {|key, value| value.nil?} data = connection.list_resource_record_sets(zone.id, options).body # Get first record