Merge pull request #22804 from rallytime/bp-22765

Backport #22765 to 2015.2
This commit is contained in:
Thomas S Hatch 2015-04-17 15:07:05 -06:00
commit 258ef59cbe
2 changed files with 7 additions and 3 deletions

View File

@ -71,14 +71,18 @@ def creds(provider):
return __AccessKeyId__, __SecretAccessKey__, __Token__
# We don't have any cached credentials, or they are expired, get them
# TODO: Wrap this with a try and handle exceptions gracefully
# Connections to instance meta-data must never be proxied
result = requests.get(
"http://169.254.169.254/latest/meta-data/iam/security-credentials/"
"http://169.254.169.254/latest/meta-data/iam/security-credentials/",
proxies={'http': ''},
)
result.raise_for_status()
role = result.text
# TODO: Wrap this with a try and handle exceptions gracefully
result = requests.get(
"http://169.254.169.254/latest/meta-data/iam/security-credentials/{0}".format(role)
"http://169.254.169.254/latest/meta-data/iam/security-credentials/{0}".format(role),
proxies={'http': ''},
)
result.raise_for_status()
data = result.json()

View File

@ -25,7 +25,7 @@ def _retry_get_url(url, num_retries=10, timeout=5):
'''
for i in range(0, num_retries):
try:
result = requests.get(url, timeout=timeout)
result = requests.get(url, timeout=timeout, proxies={'http': ''})
if hasattr(result, 'text'):
return result.text
elif hasattr(result, 'content'):