summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@nokia.com>2012-03-06 14:21:20 +0100
committerChristian Stenger <christian.stenger@nokia.com>2012-03-07 16:43:42 +0100
commit3a808b0fd8a2e9d89ff01f51ffa6014f8207979d (patch)
treea4892b4abc838a5574c8eb13c8e5f3ccc273de9a
parentaa28539731a91c275ce8804ceff01b73a551f305 (diff)
downloadqt-creator-3a808b0fd8a2e9d89ff01f51ffa6014f8207979d.tar.gz
Squish: Proxy handling to avoid Jenkins fatals
Change-Id: I89f13b9cf8887168291a29a30288affb1b46dd11 Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
-rw-r--r--tests/system/shared/workarounds.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py
index 3b2e6f8da1..40133266ce 100644
--- a/tests/system/shared/workarounds.py
+++ b/tests/system/shared/workarounds.py
@@ -116,12 +116,17 @@ class JIRA:
self._status = result[1]
return
data = None
+ proxy = os.getenv("SYSTEST_PROXY", None)
if not self._localOnly:
try:
+ if proxy:
+ proxy = urllib2.ProxyHandler({'https': proxy})
+ opener = urllib2.build_opener(proxy)
+ urllib2.install_opener(opener)
bugReport = urllib2.urlopen('%s/%s' % (JIRA_URL, bug))
data = bugReport.read()
except:
- data = self.__tryExternalTools__()
+ data = self.__tryExternalTools__(proxy)
if data == None:
test.warning("Sorry, ssl module missing - cannot fetch data via HTTPS",
"Try to install the ssl module by yourself, or set the python "
@@ -160,12 +165,18 @@ class JIRA:
# simple helper function - used as fallback if python has no ssl support
# tries to find curl or wget in PATH and fetches data with it instead of
# using urllib2
- def __tryExternalTools__(self):
+ def __tryExternalTools__(self, proxy=None):
global JIRA_URL
- cmdAndArgs = { 'curl':'-k', 'wget':'-qO-' }
+ if proxy:
+ cmdAndArgs = { 'curl':'-k --proxy %s' % proxy,
+ 'wget':'-qO-'}
+ else:
+ cmdAndArgs = { 'curl':'-k', 'wget':'-qO-' }
for call in cmdAndArgs:
prog = which(call)
if prog:
+ if call == 'wget' and proxy and os.getenv("https_proxy", None) == None:
+ test.warning("Missing environment variable https_proxy for using wget with proxy!")
return getOutputFromCmdline('"%s" %s %s/%s-%d' % (prog, cmdAndArgs[call], JIRA_URL, self._bugType, self._number))
return None