lib/aws_recon/collectors/ec2.rb in aws_recon-0.5.19 vs lib/aws_recon/collectors/ec2.rb in aws_recon-0.5.20

- old
+ new

@@ -96,11 +96,14 @@ response.vpcs.each do |vpc| struct = OpenStruct.new(vpc.to_h) struct.type = 'vpc' struct.arn = "arn:aws:ec2:#{@region}:#{@account}:vpc/#{vpc.vpc_id}" # no true ARN struct.flow_logs = @client - .describe_flow_logs({ filter: [{ name: 'resource-id', values: [vpc.vpc_id] }] }) + .describe_flow_logs({ filter: [{ + name: 'resource-id', + values: [vpc.vpc_id] + }] }) .flow_logs.first.to_h resources.push(struct.to_h) end end @@ -335,21 +338,35 @@ end # # describe_managed_prefix_lists # - @client.describe_managed_prefix_lists.each_with_index do |response, page| - log(response.context.operation_name, page) + begin + @client.describe_managed_prefix_lists.each_with_index do |response, page| + log(response.context.operation_name, page) - response.prefix_lists.each do |list| - struct = OpenStruct.new(list.to_h) - struct.type = 'prefix_list' - struct.arn = list.prefix_list_arn + response.prefix_lists.each do |list| + struct = OpenStruct.new(list.to_h) + struct.type = 'prefix_list' + struct.arn = list.prefix_list_arn - resources.push(struct.to_h) + resources.push(struct.to_h) + end end + rescue Aws::EC2::Errors::ServiceError => e + log_error(e.code) + + raise e unless suppressed_errors.include?(e.code) && !@options.quit_on_exception end end resources + end + + private + + def suppressed_errors + %w[ + InvalidAction + ] end end