From b11b9da37bf4a4b72da336c07428e6698799ea3a Mon Sep 17 00:00:00 2001 From: Josh Lane Date: Fri, 29 May 2015 16:15:52 -0700 Subject: [PATCH] fix list_managed_policies parser --- .../aws/parsers/iam/list_managed_policies.rb | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/fog/aws/parsers/iam/list_managed_policies.rb b/lib/fog/aws/parsers/iam/list_managed_policies.rb index a39f4b04a..9d54f0ebf 100644 --- a/lib/fog/aws/parsers/iam/list_managed_policies.rb +++ b/lib/fog/aws/parsers/iam/list_managed_policies.rb @@ -14,12 +14,37 @@ module Fog @response['Policies'] << policy end + def start_element(name,attrs = []) + case name + when 'AttachedPolicies' + @stack << name + when 'AttachedPolicy' + @policy = fresh_policy + when 'member' + if @stack.last == 'AttachedPolicies' + @policy = fresh_policy + end + end + super + end + def end_element(name) case name when 'RequestId', 'Marker' @response[name] = value when 'IsTruncated' @response[name] = (value == 'true') + when 'PolicyArn', 'PolicyName' + @policy[name] = value + when 'AttachedPolicies' + if @stack.last == 'AttachedPolicies' + @stack.pop + end + when 'member' + if @stack.last == 'AttachedPolicies' + finished_policy(@policy) + @policy = nil + end end super end