mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
fs.gdrive: Fix GDRIVE_CREDENTIALS_DATA for service accounts
`_validate_config()` had a bug: it would not take into account that Google Drive credentials can also be passed using `GDRIVE_CREDENTIALS_DATA` as documented here [1]. This patches the validation logic to also accept this environment variable as a means to provide service account credentials. Before, commands like `dvc push` would exit with: ``` ERROR: failed to push data to the cloud - To use service account, set `gdrive_service_account_json_file_path`, and optionally`gdrive_service_account_user_email` in DVC config Learn more at <https://man.dvc.org/remote/modify> ``` [1]: https://dvc.org/doc/user-guide/setup-google-drive-remote#authorization Co-authored-by: Laurens Duijvesteijn <[email protected]>
This commit is contained in:
committed by
David de la Iglesia Castro
co-authored by
Laurens Duijvesteijn
parent
7804e6550e
commit
6de1ddadf5
@@ -109,11 +109,14 @@ class GDriveFileSystem(FSSpecWrapper): # pylint:disable=abstract-method
|
||||
if (
|
||||
self._use_service_account
|
||||
and not self._service_account_json_file_path
|
||||
and "GDRIVE_CREDENTIALS_DATA" not in os.environ
|
||||
):
|
||||
raise DvcException(
|
||||
"To use service account, set "
|
||||
"`gdrive_service_account_json_file_path`, and optionally"
|
||||
"`gdrive_service_account_user_email` in DVC config\n"
|
||||
"You can also provide these using the GDRIVE_CREDENTIALS_DATA"
|
||||
"environment variable.\n"
|
||||
"Learn more at {}".format(
|
||||
format_link("https://man.dvc.org/remote/modify")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user