From 8c3721ff130c9e58a83e59a5737abdd7e30f165b Mon Sep 17 00:00:00 2001 From: atlantacs Date: Fri, 6 Apr 2012 22:38:44 -0300 Subject: [PATCH] Fix for stacks that have capabilities. Without this the parser misinterprets stacks with capabilities set. --- .../parsers/cloud_formation/describe_stacks.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb b/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb index 18f9c3fb2..e144308d1 100644 --- a/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +++ b/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb @@ -6,7 +6,7 @@ module Fog class DescribeStacks < Fog::Parsers::Base def reset - @stack = { 'Outputs' => [], 'Parameters' => [] } + @stack = { 'Outputs' => [], 'Parameters' => [], 'Capabilities' => [] } @output = {} @parameter = {} @response = { 'Stacks' => [] } @@ -19,7 +19,9 @@ module Fog @in_outputs = true when 'Parameters' @in_parameters = true - end + when 'Capabilities' + @in_capabilities = true + end end def end_element(name) @@ -43,11 +45,18 @@ module Fog when 'Parameters' @in_parameters = false end + elsif @in_capabilities + case name + when 'member' + @stack['Capabilities'] << value + when 'Capabilities' + @in_capabilities = false + end else case name when 'member' @response['Stacks'] << @stack - @stack = { 'Outputs' => [], 'Parameters' => [] } + @stack = { 'Outputs' => [], 'Parameters' => [], 'Capabilities' => []} when 'RequestId' @response[name] = value when 'CreationTime'