#!/usr/bin/python

from jiraauth import jclient as jira

'''
Synopsis:  This script finds all issues with a "Customer:" snippet in a comment
'''

issues = jira.search_issues('''comment ~ "Customer"''')

import re
for x in issues:
  comments = jira.comments(x.key)
  for comment in comments:
    for line in comment.body.split('\n'):
      if re.match('.*Customer:.*', line):
        print x.key + " : " + comment.author.displayName + " -- " + line
        break
#!/usr/bin/python

from jiraauth import jclient as jira
'''
Synopsis:  This script finds all issues with a "Customer:" snippet in a comment
'''

issues = jira.search_issues('''comment ~ "Customer"''')

import re
for x in issues:
    comments = jira.comments(x.key)
    for comment in comments:
        for line in comment.body.split('\n'):
            if re.match('.*Customer:.*', line):
                print x.key + " : " + comment.author.displayName + " -- " + line
                break
Example #3
0
#!/usr/bin/python

import sys
from jiraauth import jclient as jira

"""
Synopsis: ./savedsearch.py <filtername>
Example: ./savedsearch.py "Unowned, unconfirmed engineering issues"
Example 2: ./savedsearch.py 10506
"""

filterid = None
try:
    filterid = str(int(sys.argv[1]))
except ValueError:
    favs = jira.favourite_filters()
    tgt = [x.id for x in favs if x.name == sys.argv[1]]
    if len(tgt):
        filterid = tgt[0]

if filterid:
    filt = jira.filter(id=filterid)
    issues = jira.search_issues(filt.jql)
    for x in issues:
        print x.key + " | " + x.fields.summary
Example #4
0
#!/usr/bin/python

import sys
from jiraauth import jclient as jira
'''
Synopsis: ./savedsearch.py <filtername>
Example: ./savedsearch.py "Unowned, unconfirmed engineering issues"
Example 2: ./savedsearch.py 10506
'''

filterid = None
try:
    filterid = str(int(sys.argv[1]))
except ValueError:
    favs = jira.favourite_filters()
    tgt = [x.id for x in favs if x.name == sys.argv[1]]
    if len(tgt):
        filterid = tgt[0]

if filterid:
    filt = jira.filter(id=filterid)
    issues = jira.search_issues(filt.jql)
    for x in issues:
        print x.key + " | " + x.fields.summary
Example #5
0
]

basequery = '''project in (Euca2ools, Broker, "SAN Storage", Eucalyptus) AND 
               issuetype in (Bug, Improvement) AND 
               status not in (Closed, Resolved)'''

print "issuetype|status|reporter|assignee|SLA|level|flagged|count|subtotal"
sumTotal = 0
for qgroup in querygroups:
    subTotal = 0
    data = []
    for query in qgroup:
        fullquery = basequery
        for attr in [
                'issuetype', 'status', 'reporter', 'assignee', 'SLA', 'level',
                'flagged'
        ]:
            criteria = getattr(query, attr)
            if criteria:
                fullquery += " AND (%s) " % " OR ".join(
                    ["%s %s" % (attr, x) for x in criteria.split(";")])
        total, issues = jira.search_issues_with_total(fullquery)
        data.append("%s|%d" % ("|".join([repr(x) for x in query]), total))
        subTotal += total
    print "\n".join(data) + "|" + str(subTotal)
    sumTotal += subTotal

total, issues = jira.search_issues(basequery)
print "GRAND TOTAL: %d" % total
print "SUM TOTAL: %d" % sumTotal
Example #6
0
#!/usr/bin/python

import sys
from jiraauth import jclient as jira

"""
Synopsis:  This script runs an arbitrary JQL search
Example: jqlsearch.py 'project="SUP" and reporter="nbeard"'
"""

issues = jira.search_issues(sys.argv[1])

for x in issues:
    print x.key + " | " + x.fields.summary
Example #7
0
#!/usr/bin/python

import sys
from jiraauth import jclient as jira
'''
Synopsis:  This script runs an arbitrary JQL search
Example: jqlsearch.py 'project="SUP" and reporter="nbeard"'
'''

issues = jira.search_issues(sys.argv[1])

for x in issues:
    print x.key + " | " + x.fields.summary
Example #8
0
                            'in membersOf("engineering")', 'is EMPTY; = "Not Applicable"', None, None), 
                  QueryData('= Bug', 'in (Unconfirmed, Investigating)', 'not in membersOf("engineering")', 
                            'not in membersOf("engineering")', 'is EMPTY; = "Not Applicable"', None, None), ],
           ]

basequery = '''project in (Euca2ools, Broker, "SAN Storage", Eucalyptus) AND 
               issuetype in (Bug, Improvement) AND 
               status not in (Closed, Resolved)'''

print "issuetype|status|reporter|assignee|SLA|level|flagged|count|subtotal"
sumTotal = 0
for qgroup in querygroups:
  subTotal = 0
  data = []
  for query in qgroup:
    fullquery = basequery
    for attr in ['issuetype', 'status', 'reporter', 'assignee', 'SLA', 'level', 'flagged']:
        criteria = getattr(query, attr)
        if criteria:
            fullquery += " AND (%s) " % " OR ".join([ "%s %s" % (attr, x) for x in criteria.split(";") ])
    total, issues = jira.search_issues_with_total(fullquery)
    data.append("%s|%d" % ("|".join([repr(x) for x in query]), total))
    subTotal += total
  print "\n".join(data) + "|" + str(subTotal)
  sumTotal += subTotal

total, issues = jira.search_issues(basequery)
print "GRAND TOTAL: %d" % total
print "SUM TOTAL: %d" % sumTotal

Example #9
0
#!/usr/bin/python

'''
Synopsis: This script generates an html report of Engineering issues linked
to SUP issues
'''

from jiraauth import jclient as jira

issues = jira.search_issues('''project = SUP''')

def l(k):
  return '<a href="https://eucalyptus.atlassian.net/browse/%s">%s</a>' % (k, k)

def dump_issue(issuekey, customers, sups):
  issue = jira.issue(issuekey)
  print "<tr><td>"
  print ("</td><td>".join([ l(issue.key), 
               issue.fields.summary, 
               issue.fields.status.name, 
               issue.fields.issuetype.name, 
               getattr(issue.fields.assignee, 'displayName', 'Unassigned'),
               ",".join([ l(k) for k in sups ]),
               "; ".join(customers) ]) + "</td></tr>").encode("utf-8")
   
bugList = dict()
supList = dict()
for x in issues:
  if len(x.fields.issuelinks):
    # Get affected customers
    customers = [ y.value for y in x.fields.customfield_10900 or [] ]