[bts-link] 01/01: Make use of secrets module for puppetlabs JIRA too

Olivier Berger obergix at moszumanska.debian.org
Tue Dec 8 12:56:21 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 89d0418f5275b1a3bb7ca2eb80e864d0788dd803
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Tue Dec 8 13:56:11 2015 +0100

    Make use of secrets module for puppetlabs JIRA too
---
 remote/jira.py    | 15 +++++++--------
 remote/secrets.py |  1 +
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/remote/jira.py b/remote/jira.py
index 2357650..8028acb 100644
--- a/remote/jira.py
+++ b/remote/jira.py
@@ -18,6 +18,7 @@ import SOAPpy
 
 from __init__ import *
 from base import die
+from secrets import SECRETS
 
 class JIRAData:
     def __init__(self, bts, uri):
@@ -59,15 +60,13 @@ class RemoteJIRA(RemoteBts):
             except:
                 failwith(wsdl, "Error accessing Jira WSDL Proxy", exn=ConnectionFailedExn)
 
+        secretentry = self._cnf['type'] + ':' + uri
+        password = SECRETS.get(secretentry, 'bts-link')
         try:
-            self.auth = self.soap.login('bts-link', 'bts-link')
-        except:
-            # mainly for puppet (tickets.puppetlabs.com)
-            try:
-                self.auth = self.soap.login('bts-link', 'mQJ1lEYaHcsoU')
-            except SOAPpy.Types.faultType as e:
-                # Make sure to notify which Jira server refused login.
-                failwith(uri, str(e), exn=ConnectionFailedExn)
+            self.auth = self.soap.login('bts-link', password)
+        except SOAPpy.Types.faultType as e:
+            # Make sure to notify which Jira server refused login.
+            failwith(uri, str(e), exn=ConnectionFailedExn)
 
         self.status_map = {}
         for status in self.soap.getStatuses(self.auth):
diff --git a/remote/secrets.py b/remote/secrets.py
index 1163690..d9092c8 100644
--- a/remote/secrets.py
+++ b/remote/secrets.py
@@ -34,4 +34,5 @@
 SECRETS = {
     # https://developer.github.com/v3/oauth/
     'github': 'dummy-token',
+    'jira:https://tickets.puppetlabs.com': 'mQJ1lEYaHcsoU',
 }

-- 
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