Skip to content

Commit

Permalink
fix nitpicks
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi Hakim committed Jun 2, 2015
1 parent 68af21f commit eefb65e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions utils/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_proxy(agentConfig):
proxy_settings = {}

# First we read the proxy configuration from datadog.conf
proxy_host = agentConfig.get('proxy_host', None)
proxy_host = agentConfig.get('proxy_host')
if proxy_host is not None:
proxy_settings['host'] = proxy_host
try:
Expand All @@ -36,25 +36,25 @@ def get_proxy(agentConfig):
log.error('Proxy port must be an Integer. Defaulting it to 3128')
proxy_settings['port'] = 3128

proxy_settings['user'] = agentConfig.get('proxy_user', None)
proxy_settings['password'] = agentConfig.get('proxy_password', None)
log.debug("Proxy Settings: %s:%s@%s:%s" % (proxy_settings['user'],
"*****", proxy_settings['host'], proxy_settings['port']))
proxy_settings['user'] = agentConfig.get('proxy_user')
proxy_settings['password'] = agentConfig.get('proxy_password')
log.debug("Proxy Settings: %s:*****@%s:%s", proxy_settings['user'],
proxy_settings['host'], proxy_settings['port'])
return proxy_settings

# If no proxy configuration was specified in datadog.conf
# We try to read it from the system settings
try:
proxy = getproxies().get('https', None)
proxy = getproxies().get('https')
if proxy is not None:
parse = urlparse(proxy)
proxy_settings['host'] = parse.hostname
proxy_settings['port'] = int(parse.port)
proxy_settings['user'] = parse.username
proxy_settings['password'] = parse.password

log.debug("Proxy Settings: %s:%s@%s:%s" % (proxy_settings['user'],
"*****", proxy_settings['host'], proxy_settings['port']))
log.debug("Proxy Settings: %s:*****@%s:%s", proxy_settings['user'],
proxy_settings['host'], proxy_settings['port'])
return proxy_settings

except Exception, e:
Expand Down

0 comments on commit eefb65e

Please sign in to comment.