From 3272490dec7ec2e859bef209e5f82ebd80664752 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sun, 23 Sep 2012 16:28:40 +0200 Subject: [PATCH] [aws|cdn] fix incorrect get_invalidation result My change that added the get_invalidation request didn't parse the 'CallerReference' out of the response. This one is needed to match past requests to current invalidations. Signed-off-by: Brice Figureau --- lib/fog/aws/parsers/cdn/get_invalidation.rb | 8 +++++--- tests/aws/requests/cdn/cdn_tests.rb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/fog/aws/parsers/cdn/get_invalidation.rb b/lib/fog/aws/parsers/cdn/get_invalidation.rb index 1c5690861..1ac738f42 100644 --- a/lib/fog/aws/parsers/cdn/get_invalidation.rb +++ b/lib/fog/aws/parsers/cdn/get_invalidation.rb @@ -6,7 +6,7 @@ module Fog class GetInvalidation < Fog::Parsers::Base def reset - @response = { 'InvalidationBatch' => [] } + @response = { 'InvalidationBatch' => { 'Path' => [] } } end def start_element(name, attrs = []) @@ -16,9 +16,11 @@ module Fog def end_element(name) case name when 'Path' - @response['InvalidationBatch'] << @value + @response['InvalidationBatch'][name] << value when 'Id', 'Status', 'CreateTime' - @response[name] = @value + @response[name] = value + when 'CallerReference' + @response['InvalidationBatch'][name] = value end end diff --git a/tests/aws/requests/cdn/cdn_tests.rb b/tests/aws/requests/cdn/cdn_tests.rb index b80b3449b..d3be97039 100644 --- a/tests/aws/requests/cdn/cdn_tests.rb +++ b/tests/aws/requests/cdn/cdn_tests.rb @@ -108,7 +108,7 @@ Shindo.tests('Fog::CDN[:aws] | CDN requests', ['aws', 'cdn']) do response = @cf_connection.get_invalidation(@dist_id, @invalidation_id) if response.status == 200 - paths = response.body['InvalidationBatch'].sort + paths = response.body['InvalidationBatch']['Path'].sort status = response.body['Status'] if status.length > 0 and paths == [ '/test.html', '/path/to/file.html' ].sort result = true