def profile_associated(role_name, profile_name, region, key, keyid, profile):
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 try:
  profiles = conn.list_instance_profiles_for_role(role_name)
 except boto.exception.BotoServerError as e:
  log.debug(e)
  return False
 profiles = profiles.list_instance_profiles_for_role_response
 profiles = profiles.list_instance_profiles_for_role_result
 profiles = profiles.instance_profiles
 for profile in profiles:
  if (profile.instance_profile_name == profile_name):
   return True
 return False

def profile_associated ( role_name , profile_name , region , key , keyid , profile ) : conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) try : profiles = conn . list_instance_profiles_for_role ( role_name ) except boto . exception . BotoServerError as e : log . debug ( e ) return False profiles = profiles . list_instance_profiles_for_role_response profiles = profiles . list_instance_profiles_for_role_result profiles = profiles . instance_profiles for profile in profiles : if ( profile . instance_profile_name == profile_name ) : return True return False
check to see if an instance profile is associated with an iam role .