From 097acebe69515bf4be078979a161a8c90d8cf121 Mon Sep 17 00:00:00 2001 From: Zhanghao Wu Date: Mon, 26 Feb 2024 11:32:39 -0800 Subject: [PATCH] [GCP] fix application key upload (#3234) fix application key upload --- sky/clouds/gcp.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sky/clouds/gcp.py b/sky/clouds/gcp.py index ba1111ccd53..9c6fffcc435 100644 --- a/sky/clouds/gcp.py +++ b/sky/clouds/gcp.py @@ -765,20 +765,23 @@ def get_credential_file_mounts(self) -> Dict[str, str]: # credential, which causes problem for ray up multiple nodes, tracked # in #494, #496, #483. # We only add the existing credential files. It should be safe to ignore - # the missing files, as we successfully created the VM at this point, - # meaning the authentication is successful. + # the missing files, as we have checked the cloud credentials in + # `check_credentials()` when the user calls `sky check`. credentials = { f'~/.config/gcloud/{filename}': f'~/.config/gcloud/{filename}' for filename in _CREDENTIAL_FILES if os.path.exists(os.path.expanduser( f'~/.config/gcloud/{filename}')) } - application_key_path = self._find_application_key_path() - if os.path.exists(os.path.expanduser(application_key_path)): + try: + application_key_path = self._find_application_key_path() # Upload the application key path to the default path, so that # autostop and GCS can be accessed on the remote cluster. credentials[DEFAULT_GCP_APPLICATION_CREDENTIAL_PATH] = ( application_key_path) + except FileNotFoundError: + # Skip if the application key path is not found. + pass return credentials @classmethod