Merge "Add https proxy support for a hipchat/slack plugin"

This commit is contained in:
Jenkins 2016-11-30 23:07:30 +00:00 committed by Gerrit Code Review
commit 02e52aef27
3 changed files with 12 additions and 0 deletions

View File

@ -92,12 +92,17 @@ class HipChatNotifier(abstract_notifier.AbstractNotifier):
if (self._config.get("ca_certs")):
verify = self._config.get("ca_certs")
proxyDict = None
if (self._config.get("proxy")):
proxyDict = {"https": self._config.get("proxy")}
try:
# Posting on the given URL
result = requests.post(url=url,
data=hipchat_message,
verify=verify,
params=query_params,
proxies=proxyDict,
timeout=self._config['timeout'])
if result.status_code in range(200, 300):

View File

@ -88,6 +88,10 @@ class SlackNotifier(abstract_notifier.AbstractNotifier):
if (self._config.get("ca_certs")):
verify = self._config.get("ca_certs")
proxyDict = None
if (self._config.get("proxy")):
proxyDict = {"https": self._config.get("proxy")}
try:
# Posting on the given URL
self._log.debug("Sending to the url {0} , with query_params {1}".format(url, query_params))
@ -95,6 +99,7 @@ class SlackNotifier(abstract_notifier.AbstractNotifier):
data=slack_message,
verify=verify,
params=query_params,
proxies=proxyDict,
timeout=self._config['timeout'])
if result.status_code not in range(200, 300):

View File

@ -56,11 +56,13 @@ notification_types:
timeout: 5
ca_certs: "/etc/ssl/certs/ca-certificates.crt"
insecure: False
proxy: https://myproxy.corp.com:8080
slack:
timeout: 5
ca_certs: "/etc/ssl/certs/ca-certificates.crt"
insecure: False
proxy: https://myproxy.corp.com:8080
processors:
alarm: