#NEWLINE# def slurp( self ) : #NEWLINE# #INDENT# '\n        :returns: item_list - list of IAM SSH Keypairs.\n        :returns: exception_map - A dict where the keys are a tuple containing the\n            location of the exception and the value is the actual exception\n\n        ' #NEWLINE# self . prep_for_slurp ( ) #NEWLINE# item_list = [ ] #NEWLINE# exception_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# from security_monkey.common.sts_connect import connect #NEWLINE# for account in self . accounts : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ec2 = connect ( account , 'ec2' ) #NEWLINE# regions = ec2 . get_all_regions ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# exc = BotoConnectionIssue ( str ( e ) , 'keypair' , account , None ) #NEWLINE# self . slurp_exception ( ( self . index , account ) , exc , exception_map ) #NEWLINE# continue #NEWLINE# #UNINDENT# for region in regions : #NEWLINE# #INDENT# app . logger . debug ( 'Checking {}/{}/{}' . format ( Keypair . index , e , region . name ) ) #NEWLINE# try : #NEWLINE# #INDENT# rec2 = connect ( account , 'ec2' , region = region ) #NEWLINE# kps = self . wrap_aws_rate_limited_call ( rec2 . get_all_key_pairs ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# if ( region . name not in TROUBLE_REGIONS ) : #NEWLINE# #INDENT# exc = BotoConnectionIssue ( str ( e ) , 'keypair' , account , region . name ) #NEWLINE# self . slurp_exception ( ( self . index , account , region . name ) , exc , exception_map ) #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# app . logger . debug ( 'Found {} {}' . format ( len ( kps ) , Keypair . i_am_plural ) ) #NEWLINE# for kp in kps : #NEWLINE# #INDENT# if self . check_ignore_list ( kp . name ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# item_list . append ( KeypairItem ( region = region . name , account = account , name = kp . name , config = { #NEWLINE# #INDENT# 'fingerprint' : kp . fingerprint , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( item_list , exception_map )