[bts-link] 02/02: Better error reporting, and a tiny fix
Olivier Berger
obergix at moszumanska.debian.org
Tue Dec 8 12:45:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
obergix pushed a commit to branch obergix-master
in repository bts-link.
commit cb0d958fc4a91bd0f1f29e4f84e0fa5cd1fe2f1b
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date: Tue Dec 8 13:44:50 2015 +0100
Better error reporting, and a tiny fix
---
remote/jira.py | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/remote/jira.py b/remote/jira.py
index 0c8f449..2357650 100644
--- a/remote/jira.py
+++ b/remote/jira.py
@@ -20,7 +20,12 @@ from __init__ import *
from base import die
class JIRAData:
- def __init__(self, bts, id):
+ def __init__(self, bts, uri):
+
+ id = bts.extractBugid(uri)
+ if not id: return None
+
+ # initialize soap (in case we're first bug in the queue on that remote)
bts.initSoap()
issue = bts.soap.getIssue(bts.auth, id)
@@ -40,16 +45,19 @@ class RemoteJIRA(RemoteBts):
RemoteBts.__init__(self, cnf, bugre, urifmt, JIRAData)
def initSoap(self):
- if hasattr(self, 'soap'):
+ # no need to do anything if we've already set up a proxy and have succeeded in authenticating
+ if hasattr(self, 'soap') and hasattr(self, 'auth'):
return
uri = self._cnf['uri']
wsdl = uri + '/rpc/soap/jirasoapservice-v2?wsdl'
- try:
- self.soap = SOAPpy.WSDL.Proxy(wsdl)
- except:
- print "E: error accessing", wsdl
- return None
+
+ # We may have previously set up the proxy but need to authenticate again
+ if not hasattr(self, 'soap'):
+ try:
+ self.soap = SOAPpy.WSDL.Proxy(wsdl)
+ except:
+ failwith(wsdl, "Error accessing Jira WSDL Proxy", exn=ConnectionFailedExn)
try:
self.auth = self.soap.login('bts-link', 'bts-link')
@@ -59,7 +67,7 @@ class RemoteJIRA(RemoteBts):
self.auth = self.soap.login('bts-link', 'mQJ1lEYaHcsoU')
except SOAPpy.Types.faultType as e:
# Make sure to notify which Jira server refused login.
- die('could not login to %s : %s!' % (uri, str(e)))
+ failwith(uri, str(e), exn=ConnectionFailedExn)
self.status_map = {}
for status in self.soap.getStatuses(self.auth):
@@ -70,10 +78,8 @@ class RemoteJIRA(RemoteBts):
self.resolution_map[resolution.id] = resolution.name
def _getReportData(self, uri):
- id = self.extractBugid(uri)
- if not id: return None
-
- data = JIRAData(self, id)
+
+ data = JIRAData(self, uri)
return data
def isClosing(self, status, resolution):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bts-link/bts-link.git
More information about the bts-link-commits
mailing list