Skip to content

Commit

Permalink
fix missing do credential for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
asaiacai committed Nov 27, 2024
1 parent 8658ffa commit 2c7d530
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sky/clouds/do.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,22 @@ def check_credentials(cls) -> Tuple[bool, Optional[str]]:
"""Verify that the user has valid credentials for DO."""
try:
# attempt to make a CURL request for listing instances
do_utils.client().droplets.list()
client = do_utils.client()
if client is None:
return False, "no valid credentials found, run `doctl auth init`"
client.droplets.list()
except do.exceptions().HttpResponseError as err:
return False, str(err)

return True, None

def get_credential_file_mounts(self) -> Dict[str, str]:
try:
do_utils.client() # to initialize `do_utils.CREDENTIALS_PATH`
client = do_utils.client() # to initialize `do_utils.CREDENTIALS_PATH`
if client is not None:
return {
f'~/.config/doctl/{_CREDENTIAL_FILE}': do_utils.CREDENTIALS_PATH
}
except do_utils.DigitalOceanError as err:
logger.debug(err)
else:
return {}

@classmethod
Expand Down

0 comments on commit 2c7d530

Please sign in to comment.