mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #22804 from rallytime/bp-22765
Backport #22765 to 2015.2
This commit is contained in:
commit
258ef59cbe
@ -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()
|
||||
|
@ -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'):
|
||||
|
Loading…
Reference in New Issue
Block a user