[Jenkins][ci skip] Fix proxy address in post-build.py

This commit is contained in:
lm 2014-06-03 11:48:52 +08:00
parent 26a4eaaac7
commit be3f88c4ce
1 changed files with 4 additions and 4 deletions

View File

@ -5,9 +5,7 @@ import jenkinsapi
from jenkinsapi.jenkins import Jenkins
from jenkinsapi.constants import STATUS_SUCCESS
http_proxy = ''
if(os.environ.has_key('HTTP_PROXY')):
http_proxy = os.environ['HTTP_PROXY']
payload_str = os.environ['payload']
payload_str = payload_str.decode('utf-8','ignore')
#parse to json obj
payload = json.loads(payload_str)
@ -31,6 +29,8 @@ if(result == STATUS_SUCCESS):
else:
data['state'] = "failure"
http_proxy = os.environ['HTTP_PROXY']
http_proxy = ''
if(os.environ.has_key('HTTP_PROXY')):
http_proxy = os.environ['HTTP_PROXY']
proxyDict = {'http':http_proxy,'https':http_proxy}
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)