Remove usage of os.environ.setdefault (#621)

This is somewhat misleading, since it doesn't change the
value of the env. var. in the shell.
This commit is contained in:
Danny Hermes
2016-08-11 11:14:46 -07:00
committed by Jon Wayne Parrott
parent 5190fd70bb
commit 6a12a1fb58

View File

@@ -99,13 +99,12 @@ AccessTokenInfo = collections.namedtuple(
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')
NO_GCE_CHECK = os.getenv('NO_GCE_CHECK', 'False')
# Timeout in seconds to wait for the GCE metadata server when detecting the
# GCE environment.
try:
GCE_METADATA_TIMEOUT = int(
os.environ.setdefault('GCE_METADATA_TIMEOUT', '3'))
GCE_METADATA_TIMEOUT = int(os.getenv('GCE_METADATA_TIMEOUT', 3))
except ValueError: # pragma: NO COVER
GCE_METADATA_TIMEOUT = 3