[asterisk-commits] Change in repotools[master]: mapmantis: Remove dependency on digium_jira
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 13 16:45:26 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: mapmantis: Remove dependency on digium_jira
......................................................................
mapmantis: Remove dependency on digium_jira
This patch removes the dependency of mapmantis from the digium_jira
module. The DigiumJIRA class, which uses a SOAP library for its
connection back to JIRA, was not strictly necessary as the Mantis
mapping function made no connection back to the JIRA instance.
Change-Id: I0ae337d24e3db7d552406a57a740d260d5c4d2d7
---
M digium_jira.py
M mapmantis.py
2 files changed, 41 insertions(+), 31 deletions(-)
Approvals:
Mark Michelson: Looks good to me, but someone else must approve
Matt Jordan: Looks good to me, approved; Verified
diff --git a/digium_jira.py b/digium_jira.py
index abbbfaa..bd4734f 100644
--- a/digium_jira.py
+++ b/digium_jira.py
@@ -137,28 +137,6 @@
return f["id"]
return None
- def map_mantis_to_jira(self, mantis_id):
- if self.mantis_map is None:
- try:
- f = open("mantis-to-jira-map.txt", "r")
- except:
- try:
- f = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "mantis-to-jira-map.txt"), "r")
- except:
- print "Failed to find mantis-to-jira-map.txt"
- return 1
- self.mantis_map = {}
- for line in f:
- fields = line.split("\t")
- self.mantis_map[fields[0]] = fields[1].strip()
- f.close()
-
- if mantis_id in self.mantis_map:
- return self.mantis_map[mantis_id]
- else:
- return None
-
def status_to_str(self, status):
if self.status_map is None:
statuses = self.jira.getStatuses(self.auth)
diff --git a/mapmantis.py b/mapmantis.py
index 243bd35..ec1ac5d 100755
--- a/mapmantis.py
+++ b/mapmantis.py
@@ -1,29 +1,61 @@
#!/usr/bin/env python
+"""Find a JIRA issue ID based on the Mantis ID
-'''
-This module is deprecated since mantis is no longer in use and it requires digium_jira which has been
-deprecated in favor of jira-python
-'''
-
+Copyright (C) 2011-2015, Digium Inc.
+Russell Bryant <russell at russellbryant.com>
+"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__))))
-from digium_jira import DigiumJIRA
+
+def map_mantis_to_jira(mantis_id):
+ """Maps a Mantis issue ID to an Atlassian JIRA ID
+
+ Keyword Arguments:
+ mantis_id - the Mantis ID to look up
+
+ Returns:
+ None if no Atlassian JIRA issue is found
+ The Atlassian JIRA issue that maps to the Mantis issue
+ """
+
+ mantis_map = {}
+ try:
+ m_file = open("mantis-to-jira-map.txt", "r")
+ except IOError:
+ path = os.path.dirname(os.path.realpath(__file__))
+ try:
+ m_file = open(os.path.join(path, "mantis-to-jira-map.txt"), "r")
+ except IOError:
+ print "Failed to find mantis-to-jira-map.txt"
+ return 1
+
+ for line in m_file:
+ fields = line.split("\t")
+ mantis_map[fields[0]] = fields[1].strip()
+ m_file.close()
+
+ return mantis_map.get(mantis_id)
def main(argv=None):
+ """Main entry point
+
+ Keyword Arguments:
+ argv - parameters passed on command line
+ """
if argv is None:
argv = sys.argv
if len(argv) != 2:
- print "usage: %s <mantis id>" % os.path.basename(argv[0])
+ print "Usage: %s <mantis id>" % os.path.basename(argv[0])
return 1
- print DigiumJIRA(soap_access=False).map_mantis_to_jira(argv[1]) or "not found"
-
+ print map_mantis_to_jira(argv[1]) or "No JIRA issue found."
return 0
+
if __name__ == "__main__":
sys.exit(main())
--
To view, visit https://gerrit.asterisk.org/68
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0ae337d24e3db7d552406a57a740d260d5c4d2d7
Gerrit-PatchSet: 2
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list