示例#1
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
示例#2
0
from jiraauth import jclient
import debugmode

"""
This script was used to copy target versions (customfield_10304)
into the fix version field.  It's a decent example of how to
iterate over search results and update issues in the result set
"""

i = 0
maxResults=50
num = 50
while i < num:
    num, results = jclient.search_issues_with_total('"Target Version/s" is not EMPTY and status not in (Resolved, Closed)', startAt=i)
    for issue in results:
        print "checking " + issue.key
        newFixVersions = None
        for target_version in issue.fields.customfield_10304:
            if not len([ x for x in issue.fields.fixVersions if x.id == target_version.id ]):
                if not newFixVersions:
                    newFixVersions = [ x for x in issue.fields.fixVersions ]
                newFixVersions.append(target_version)
        if newFixVersions:
            print "Updating " + issue.key + " was " + \
                  ",".join(sorted([x.name for x in issue.fields.fixVersions ])) + \
                  " now " + ",".join(sorted([x.name for x in newFixVersions ]))
            issue.update(fixVersions=[ { 'name': x.name } for x in newFixVersions ])
    i += maxResults
    print i
     
示例#3
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