def main(username, project, list): pyrax.set_setting('identity_type', 'rackspace') with open(os.path.expanduser('~/.bugminion'), 'r') as f: conf = json.loads(f.read()) pyrax.set_credentials(conf['access_key'], conf['secret_key'], region=conf['region'].upper()) conn = pyrax.connect_to_cloudfiles(region=conf['region'].upper()) container = conn.create_container(conf['container']) # Prioritize a list of bugs from an input file now = datetime.datetime.now() datestamp = '%04d%02d%02d' %(now.year, now.month, now.day) with open(list) as f: for bug in f.readlines(): bug = bug.rstrip() triage = {'reviewer': username, 'osic': 'y'} common.clobber_object(container, '%s-bug/%s-%s' %(project, bug, datestamp), json.dumps(triage, indent=4, sort_keys=True)) print 'Done!'
def main(username, project): pyrax.set_setting('identity_type', 'rackspace') with open(os.path.expanduser('~/.bugminion'), 'r') as f: conf = json.loads(f.read()) pyrax.set_credentials(conf['access_key'], conf['secret_key'], region=conf['region'].upper()) conn = pyrax.connect_to_cloudfiles(region=conf['region'].upper()) container = conn.create_container(conf['container']) # Read the most recent bug dump most_recent = common.get_most_recent_dump(container, project) most_recent_datestamp = most_recent.split('/')[1] print 'Using the dump from %s' % most_recent bug_list = json.loads(container.get_objects(prefix=most_recent)[0].get()) for priority in common.PRIORITIES: targets = bug_list.get(priority, []) random.shuffle(targets) for bug in targets: triages = common.triages(container, project, bug) if not common.recently_triaged(triages): print 'Bug %s (%s) is not triaged' %(bug, priority) print 'Triages: %s' % triages data = json.loads(container.get_object('%s-bug/%s' %(project, bug)).get()) for field in common.DISPLAY_ORDER: print '%s: %s' %(field, data.get(field, '')) print 'tags: %s' % ' '.join(data.get('tags', [])) print print 'Description:' print print data.get('description') print triage = {'reviewer': username} sys.stdout.write('OSIC (y/n)? ') triage['osic'] = sys.stdin.readline().rstrip() if triage['osic'] == 'y': for question in common.QUESTIONS: sys.stdout.write('%s? ' % question) answer = sys.stdin.readline().rstrip() triage[question] = answer common.clobber_object(container, '%s-bug/%s-%s' %(project, bug, most_recent_datestamp), json.dumps(triage, indent=4, sort_keys=True)) print print print 'Done!'
def main(username, project): pyrax.set_setting("identity_type", "rackspace") with open(os.path.expanduser("~/.bugminion"), "r") as f: conf = json.loads(f.read()) pyrax.set_credentials(conf["access_key"], conf["secret_key"], region=conf["region"].upper()) conn = pyrax.connect_to_cloudfiles(region=conf["region"].upper()) container = conn.create_container(conf["container"]) print "Collecting bugs" today = {} lp = launchpad.Launchpad.login_with(username, LP_INSTANCE, CACHE_DIR) bugs = lp.projects[project].searchTasks(status=["New", "Incomplete", "Confirmed", "Triaged", "In Progress"]) count = 0 progress = progressbar.ProgressBar(maxval=bugs.total_size) progress.start() for bug in bugs: bug_data = {} for field in common.SAVED_FIELDS: bug_data[field] = bug.bug.__getattr__(field) for task in bug.bug.bug_tasks: if task.bug_target_name == project: today.setdefault(task.importance, []) today[task.importance].append(bug.bug.id) for field in common.SAVED_TASK_FIELDS: bug_data[field] = task.__getattr__(field) # Sanitize fields for private security bugs if bug.bug.information_type == "Private Security": for field in PRIVATE_FIELDS: bug_data[field] == "*** Embargoed Security Bug ***" # Sanitize date fields to something JSON can handle for field in bug_data: if field.startswith("date_") and bug_data[field]: bug_data[field] = time.mktime(bug_data[field].timetuple()) # Write a project-centric view of this bug to cloudfiles object_name = "%s-bug/%s" % (project, bug_data["id"]) common.clobber_object(container, object_name, json.dumps(bug_data, indent=4, sort_keys=True)) count += 1 try: progress.update(count) except ValueError: # Believe it or not, if a bug is filed during the run, we crash # otherwise pass progress.finish() print "Updating state map" common.clobber_object( container, "%s/%04d%02d%02d" % (project, NOW.year, NOW.month, NOW.day), json.dumps(today, indent=4, sort_keys=True), )