Skip to content

Commit

Permalink
solve error
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Dec 20, 2022
1 parent 7ed02d3 commit 7874618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions sky/clouds/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import typing
from typing import Dict, Iterator, List, Optional, Tuple

from sky.adaptors import aws
from sky import clouds
from sky import exceptions
from sky.adaptors import aws
Expand Down Expand Up @@ -387,18 +386,18 @@ def get_current_user_identity(self) -> Optional[str]:
# Refer to https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html # pylint: disable=line-too-long
# and https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable # pylint: disable=line-too-long
user_id = sts.get_caller_identity()['UserId']
except aws.exceptions().NoCredentialsError:
except aws.botocore_exceptions().NoCredentialsError:
with ux_utils.print_exception_no_traceback():
raise exceptions.CloudUserIdentityError(
f'AWS credentials are not set. {self._STATIC_CREDENTIAL_HELP_STR}'
) from None
except aws.exceptions().ClientError:
except aws.botocore_exceptions().ClientError:
with ux_utils.print_exception_no_traceback():
raise exceptions.CloudUserIdentityError(
'Failed to access AWS services with credentials. '
'Make sure that the access and secret keys are correct.'
f' {self._STATIC_CREDENTIAL_HELP_STR}') from None
except aws.exceptions().TokenRetrievalError:
except aws.botocore_exceptions().TokenRetrievalError:
# This is raised when the access token is expired, which mainly
# happens when the user is using temporary credentials or SSO
# login.
Expand Down
2 changes: 1 addition & 1 deletion sky/clouds/service_catalog/data_fetchers/fetch_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _get_availability_zones(region: str) -> Optional[pd.DataFrame]:
zones = []
try:
response = client.describe_availability_zones()
except aws.exceptions().ClientError:
except aws.botocore_exceptions().ClientError:
# The user's AWS account may not have access to this region.
# The error looks like:
# botocore.exceptions.ClientError: An error occurred
Expand Down

0 comments on commit 7874618

Please sign in to comment.