Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Avoid GCE checking if NO_GCE_CHECK is True #111

Merged
merged 6 commits into from
Jan 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion oauth2client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
'AccessTokenInfo', ['access_token', 'expires_in'])

DEFAULT_ENV_NAME = 'UNKNOWN'

# If set to True _get_environment avoid GCE check (_detect_gce_environment)
NO_GCE_CHECK = os.environ.setdefault('NO_GCE_CHECK', 'False')

class SETTINGS(object):
"""Settings namespace for globally defined values."""
env_name = None
Expand Down Expand Up @@ -970,7 +974,7 @@ def _get_environment(urlopen=None):
SETTINGS.env_name = 'GAE_PRODUCTION'
elif server_software.startswith('Development/'):
SETTINGS.env_name = 'GAE_LOCAL'
elif _detect_gce_environment(urlopen=urlopen):
elif NO_GCE_CHECK != 'True' and _detect_gce_environment(urlopen=urlopen):
SETTINGS.env_name = 'GCE_PRODUCTION'

return SETTINGS.env_name
Expand Down