When getting a role/profile, catch only exception that indicates the role/profile already exists, allow others to be raised (#3383)

This commit is contained in:
GiliR4t1qbit 2018-11-22 09:42:58 -08:00 committed by Eric Liang
parent 24bfe8ab76
commit b9ae5edf74

View file

@ -10,6 +10,7 @@ import time
import boto3
from botocore.config import Config
import botocore
from ray.ray_constants import BOTO_MAX_RETRIES
@ -272,7 +273,7 @@ def _get_role(role_name, config):
try:
role.load()
return role
except Exception:
except botocore.errorfactory.NoSuchEntityException:
return None
@ -282,7 +283,7 @@ def _get_instance_profile(profile_name, config):
try:
profile.load()
return profile
except Exception:
except botocore.errorfactory.NoSuchEntityException:
return None