Skip to content

Commit

Permalink
Do not set gsutil credentials. (#1330)
Browse files Browse the repository at this point in the history
User accounts credentials are no longer supported by `gsutil`. The
recommendation is to use `gcloud storage` instead. See full details in
bug.

We will add a script tip in the notebook editor to tell users using
`gsutil` to use `gcloud storage` instead.

http://b/313996272
  • Loading branch information
rosbo authored Nov 30, 2023
1 parent ba38086 commit 8c70958
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions patches/kaggle_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def set_gcloud_credentials(self, project=None, account=None):
"""
creds = self.get_gcloud_credential()
creds_path = self._write_credentials_file(creds)
self._write_gsutil_credentials_file(creds)

subprocess.run(['gcloud', 'config', 'set', 'auth/credential_file_override', creds_path])

Expand Down Expand Up @@ -139,17 +138,6 @@ def _write_credentials_file(self, credentials) -> str:

return adc_path

def _write_gsutil_credentials_file(self, credentials) -> str:
import json
creds_dict = json.loads(credentials)
boto_path = os.path.join(os.environ.get('HOME', '/'), '.boto')
with open(boto_path, 'w') as f:
f.write('[Credentials]\n')
f.write(' gs_oauth2_refresh_token = ')
f.write(creds_dict['refresh_token'])

return boto_path

def _get_gcs_access_token(self) -> Tuple[str, Optional[datetime]]:
return self._get_access_token(GcpTarget.GCS)

Expand Down

0 comments on commit 8c70958

Please sign in to comment.