mirror of
https://github.com/clearml/clearml
synced 2025-02-07 05:18:50 +00:00
Support GS credentials as JSON string if not a JSON file reference
This commit is contained in:
parent
4303664d5b
commit
e746b3e535
@ -791,10 +791,21 @@ class _GoogleCloudStorageDriver(_Driver):
|
|||||||
self.name = name[len(_GoogleCloudStorageDriver.scheme_prefix):]
|
self.name = name[len(_GoogleCloudStorageDriver.scheme_prefix):]
|
||||||
|
|
||||||
if cfg.credentials_json:
|
if cfg.credentials_json:
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
credentials = service_account.Credentials.from_service_account_file(cfg.credentials_json)
|
credentials = service_account.Credentials.from_service_account_file(cfg.credentials_json)
|
||||||
except ValueError:
|
except Exception:
|
||||||
credentials = None
|
credentials = None
|
||||||
|
|
||||||
|
if not credentials:
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
|
# Try parsing this as json to support actual json content and not a file path
|
||||||
|
credentials = service_account.Credentials.from_service_account_info(
|
||||||
|
json.loads(cfg.credentials_json)
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
credentials = None
|
credentials = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user