Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Boto HTTP proxy configuration #3722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion utils/cloud_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import types
import os
import re
import socket

# 3rd party
Expand Down Expand Up @@ -198,12 +199,17 @@ def get_tags(agentConfig):

import boto.ec2
proxy_settings = get_proxy(agentConfig) or {}

proxy_host = proxy_settings.get('host')
if proxy_host is not None:
proxy_host = re.sub(r'^http(s?)://', '', proxy_host)

connection = boto.ec2.connect_to_region(
region,
aws_access_key_id=iam_params['AccessKeyId'],
aws_secret_access_key=iam_params['SecretAccessKey'],
security_token=iam_params['Token'],
proxy=proxy_settings.get('host'), proxy_port=proxy_settings.get('port'),
proxy=proxy_host, proxy_port=proxy_settings.get('port'),
proxy_user=proxy_settings.get('user'), proxy_pass=proxy_settings.get('password')
)

Expand Down