Merge "Add launchpad support to check_success"

This commit is contained in:
Jenkins 2013-11-26 19:07:44 +00:00 committed by Gerrit Code Review
commit 142d520dba
1 changed files with 21 additions and 1 deletions

View File

@ -15,9 +15,14 @@
# under the License.
import argparse
import os
from launchpadlib import launchpad
import elastic_recheck.elasticRecheck as er
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
def get_options():
parser = argparse.ArgumentParser(description='Edit hiera yaml.')
@ -55,16 +60,31 @@ def collect_metrics(classifier):
def print_metrics(data):
print "Elastic recheck known issues"
print
sorted_data = sorted(data.iteritems(),
key=lambda x: -x[1]['fails'])
for d in sorted_data:
print "Bug: %s => %s" % (d[0], d[1]['query'].rstrip())
print "Bug: https://bugs.launchpad.net/bugs/%s => %s" % (d[0], d[1]['query'].rstrip())
get_launchpad_bug(d[0])
print "Hits"
for s in d[1]['hits'].keys():
print " %s: %s" % (s, len(d[1]['hits'][s]))
print
def get_launchpad_bug(bug):
lp = launchpad.Launchpad.login_anonymously('grabbing bugs',
'production',
LPCACHEDIR)
lp_bug = lp.bugs[bug]
print "Title: %s" % lp_bug.title
targets = map(lambda x: (x.bug_target_name, x.status), lp_bug.bug_tasks)
print "Project: Status"
for target, status in targets:
print " %s: %s" % (target, status)
def main():
opts = get_options()
classifier = er.Classifier(opts.file)