Skip to content

Commit

Permalink
Add jira support
Browse files Browse the repository at this point in the history
  • Loading branch information
asdil12 committed Mar 8, 2019
1 parent d597ba9 commit 3b3ecfd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bugfetcher.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ pass = bar

[progress]
api_key = blub

[jira]
user = foo
pass = bar
22 changes: 22 additions & 0 deletions openqa_bugfetcher/issues/jira_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3

from openqa_bugfetcher.issues import BaseIssue
import requests

class JiraIssue(BaseIssue):
prefixes = {'jsc'}

def fetch(self, conf):
issue_id = self.bugid.split('#')[1]
url = "https://jira.suse.de/rest/api/2/issue/%s" % issue_id
a = conf['jira']
r = requests.get(url, auth=(a['user'], a['pass']))
if r.ok:
j = r.json()['fields']
self.title = j['summary']
self.priority = j['priority']['name']
self.status = j['status']['name']
self.open = self.status not in ('Rejected', 'Resolved', 'Closed')
else:
assert r.status_code != 401, "Wrong auth for Jira"
self.existing = False

0 comments on commit 3b3ecfd

Please sign in to comment.