Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3008 from quadproduction/site-sync-gdrive-credent…
Browse files Browse the repository at this point in the history
…ial-path-resolve-env

Resolve environment variable in google drive credential path
  • Loading branch information
kalisp authored Apr 7, 2022
2 parents 0f9e40a + 57ecd9a commit cdbcfad
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions openpype/modules/sync_server/providers/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,23 @@ def __init__(self, project_name, site_name, tree=None, presets=None):
format(site_name))
return

cred_path = self.presets.get("credentials_url", {}).\
get(platform.system().lower()) or ''
current_platform = platform.system().lower()
cred_path = self.presets.get("credentials_url", {}). \
get(current_platform) or ''

if not cred_path:
msg = "Sync Server: Please, fill the credentials for gdrive "\
"provider for platform '{}' !".format(current_platform)
log.info(msg)
return

try:
cred_path = cred_path.format(**os.environ)
except KeyError as e:
log.info("Sync Server: The key(s) {} does not exist in the "
"environment variables".format(" ".join(e.args)))
return

if not os.path.exists(cred_path):
msg = "Sync Server: No credentials for gdrive provider " + \
"for '{}' on path '{}'!".format(site_name, cred_path)
Expand Down

0 comments on commit cdbcfad

Please sign in to comment.