Merge lp:~abentley/lp-release-manager-tools/credentials-option into lp:~sinzui/lp-release-manager-tools/trunk

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 26
Proposed branch: lp:~abentley/lp-release-manager-tools/credentials-option
Merge into: lp:~sinzui/lp-release-manager-tools/trunk
Diff against target: 71 lines (+15/-11)
2 files modified
lp_release_tools/pull_bugs.py (+6/-2)
lp_release_tools/report_bugs.py (+9/-9)
To merge this branch: bzr merge lp:~abentley/lp-release-manager-tools/credentials-option
Reviewer Review Type Date Requested Status
Curtis Hovey code Approve
Review via email: mp+220852@code.launchpad.net

Commit message

Tweaks for Juju Reports.

Description of the change

Some tweaks to support use for Juju Reports.

Since there is no keyring on the Juju Reports machine, this branch provides a -C option for supplying a credentials file.

Since juju-reports allows the start day to be configured and runs 10 cycles at a time, allow these values to be overridden for make_cycles.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lp_release_tools/pull_bugs.py'
2--- lp_release_tools/pull_bugs.py 2014-02-13 14:01:50 +0000
3+++ lp_release_tools/pull_bugs.py 2014-05-24 02:14:53 +0000
4@@ -103,6 +103,9 @@
5 parser.add_option(
6 "-s", "--statuses", dest="statuses", action="append",
7 type="string", help="Match bugs with all of the listed statues.")
8+ parser.add_option(
9+ "-C", "--credentials", dest="credentials", type="string",
10+ help="Launchpad credentials file.")
11 parser.set_defaults(
12 outfile='bug-data.json',
13 union_file=None,
14@@ -111,7 +114,8 @@
15 tags=None,
16 milestone=None,
17 importance=None,
18- statuses=[]
19+ statuses=[],
20+ credentials=None,
21 )
22 return parser
23
24@@ -134,7 +138,7 @@
25 lp = Launchpad.login_with(
26 'milestone-report',
27 service_root='https://api.launchpad.net',
28- version='devel')
29+ version='devel', credentials_file=options.credentials)
30 targets = get_targets(lp, project)
31 search_params = dict(
32 status=options.statuses, modified_since=options.since,
33
34=== modified file 'lp_release_tools/report_bugs.py'
35--- lp_release_tools/report_bugs.py 2014-03-03 13:45:39 +0000
36+++ lp_release_tools/report_bugs.py 2014-05-24 02:14:53 +0000
37@@ -95,7 +95,7 @@
38 triaged_count += 1
39 if triaged_count == 0:
40 return 0
41- average_triage_time = delta / triaged_count
42+ average_triage_time = delta / triaged_count
43 return average_triage_time.days
44
45 @staticmethod
46@@ -117,17 +117,17 @@
47 return bugs
48
49
50-def make_cycles(today, tag_groups, importance_groups):
51- """Return a list of bug reporting cycles."""
52+def make_cycles(today, tag_groups, importance_groups, start_day=6,
53+ cycle_count=26):
54+ """Return a list of bug reporting cycles.
55+
56+ :param start_day: Starts on Sunday by default. AU Monday is UTC Sunday.
57+ """
58 cycles = []
59- SUNDAY = 6 # AU Monday is UTC Sunday.
60 WEEK = timedelta(7)
61 this_day = today.weekday()
62- if this_day != SUNDAY:
63- finish_date = today + timedelta(SUNDAY - this_day)
64- else:
65- finish_date = today
66- for ignore in range(26):
67+ finish_date = today + timedelta((start_day - this_day) % 7)
68+ for ignore in range(cycle_count):
69 start_date = finish_date - WEEK
70 cycle = WorkCycle(
71 start_date, finish_date, tag_groups, importance_groups)

Subscribers

People subscribed via source and target branches

to all changes: