Add launchpad support to check_success

Make check_success query launchpad to provide more useful output.

The goal is to make the output of check_success more useful by adding
bug title, and affected projects etc.

Change-Id: Ifd95056ade720be080cccf36196fad7bf4514ffd
This commit is contained in:
Joe Gordon 2013-11-19 21:38:59 -08:00
parent f3a51c512c
commit 35bb428f95
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)