Merge lp:~leonardr/ubuntu-qa-tools/fix-api-usage into lp:ubuntu-qa-tools

Proposed by Leonard Richardson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~leonardr/ubuntu-qa-tools/fix-api-usage
Merge into: lp:ubuntu-qa-tools
Diff against target: 104 lines (+10/-9)
6 files modified
bug-report-framework/bugs-since-sometime.py (+1/-1)
bugs-mailinglist/ml-fixes-report (+2/-2)
bugs-mailinglist/ml-team-fixes-report (+2/-2)
launchpadlib-scripts/bugsquad-membership.py (+1/-1)
launchpadlib-scripts/packages-without-subscribers.py (+3/-2)
responses/security/unlinkcves (+1/-1)
To merge this branch: bzr merge lp:~leonardr/ubuntu-qa-tools/fix-api-usage
Reviewer Review Type Date Requested Status
Ara Pulido Needs Information
Review via email: mp+22541@code.launchpad.net

Description of the change

Hi,

This branch removes the assumption in several scripts that the user is using the 'beta' version of the Launchpad web service. This will make it possible to use the scripts against the new '1.0' version. In several places it incorporates a workaround for bug 524775.

Leonard

To post a comment you must log in.
Revision history for this message
Ara Pulido (ara) wrote :

Running one of your modified scripts I got the following error:

./bugs-since-sometime.py 3
Traceback (most recent call last):
  File "./bugs-since-sometime.py", line 57, in <module>
    primary = launchpad.load(launchpad._root_uri + 'ubuntu/+archive/primary')
TypeError: unsupported operand type(s) for +: 'URI' and 'str'

review: Needs Information
322. By Leonard Richardson

Use str(root_uri) instead of root_uri itself.

Revision history for this message
Leonard Richardson (leonardr) wrote :

Good catch. I've fixed all instances of the problem and tested bugs-since-sometime myself.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bug-report-framework/bugs-since-sometime.py'
2--- bug-report-framework/bugs-since-sometime.py 2010-02-25 21:06:52 +0000
3+++ bug-report-framework/bugs-since-sometime.py 2010-03-31 18:50:42 +0000
4@@ -54,7 +54,7 @@
5
6 bugcontrol = launchpad.people['ubuntu-bugcontrol']
7
8-primary = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+archive/primary')
9+primary = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+archive/primary')
10
11 importances = { 'Critical':1, 'High':2, 'Medium':3, 'Low':4, 'Wishlist':5, 'Undecided':6 }
12
13
14=== modified file 'bugs-mailinglist/ml-fixes-report'
15--- bugs-mailinglist/ml-fixes-report 2010-03-31 16:37:16 +0000
16+++ bugs-mailinglist/ml-fixes-report 2010-03-31 18:50:42 +0000
17@@ -70,7 +70,7 @@
18 if bug_number in bug_numbers:
19 continue
20 try:
21- task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
22+ task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
23 bug = launchpad.bugs[bug_number]
24 except HTTPError, error:
25 print "There was an error with LP: #%s: %s" % (bug_number, error)
26@@ -119,7 +119,7 @@
27 print "There was an error with bug LP: #%s: %s" % (bug_number, error.content)
28 bug_numbers.append(bug_number)
29
30- #task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
31+ #task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
32 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )
33 #if task.date_created is None and task.date_fix_released is None:
34 #print "\tProbable incorrect bug number in changelog!"
35
36=== modified file 'bugs-mailinglist/ml-team-fixes-report'
37--- bugs-mailinglist/ml-team-fixes-report 2010-03-31 16:37:16 +0000
38+++ bugs-mailinglist/ml-team-fixes-report 2010-03-31 18:50:42 +0000
39@@ -76,7 +76,7 @@
40 if fixer not in team_members:
41 continue
42 try:
43- task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
44+ task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
45 bug = launchpad.bugs[bug_number]
46 except HTTPError, error:
47 print "There was an error with LP: #%s: %s" % (bug_number, error)
48@@ -126,7 +126,7 @@
49 print "There was an error with bug LP: #%s: %s" % (bug_number, error)
50 bug_numbers.append(bug_number)
51
52- #task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
53+ #task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
54 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )
55 #if task.date_created is None and task.date_fix_released is None:
56 #print "\tProbable incorrect bug number in changelog!"
57
58=== modified file 'launchpadlib-scripts/bugsquad-membership.py'
59--- launchpadlib-scripts/bugsquad-membership.py 2010-03-01 17:38:42 +0000
60+++ launchpadlib-scripts/bugsquad-membership.py 2010-03-31 18:50:42 +0000
61@@ -45,7 +45,7 @@
62 expiration_date = future.strftime("%Y-%m-%d")
63
64 if person.is_ubuntu_coc_signer:
65- member_detail = launchpad.load('https://api.edge.launchpad.net/beta/~bugsquad/+member/%s' % lpid)
66+ member_detail = launchpad.load(str(launchpad._root_uri) + '~bugsquad/+member/%s' % lpid)
67 if member_detail.status == 'Proposed':
68 # approving a member will use the default expiration date set for the team which is good
69 try:
70
71=== modified file 'launchpadlib-scripts/packages-without-subscribers.py'
72--- launchpadlib-scripts/packages-without-subscribers.py 2010-01-05 03:28:06 +0000
73+++ launchpadlib-scripts/packages-without-subscribers.py 2010-03-31 18:50:42 +0000
74@@ -8,7 +8,8 @@
75 # Find packages that do not have any subscribers
76 # and may be neglected
77
78-from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT, STAGING_SERVICE_ROOT
79+from launchpadlib.launchpad import Launchpad
80+from launchpadlib.uris import LPNET_SERVICE_ROOT
81 from launchpadlib.errors import HTTPError
82 from launchpadlib.credentials import Credentials
83
84@@ -23,7 +24,7 @@
85
86 credfile = os.path.expanduser('~/.launchpadlib/%s.cred' % script_name)
87
88-root = 'https://api.launchpad.net/beta/'
89+root = LPNET_SERVICE_ROOT
90
91 try:
92 credentials = Credentials()
93
94=== modified file 'responses/security/unlinkcves'
95--- responses/security/unlinkcves 2009-03-30 18:14:45 +0000
96+++ responses/security/unlinkcves 2010-03-31 18:50:42 +0000
97@@ -14,6 +14,6 @@
98 for b in ['157919','209901','246067']:
99 bug = lp.bugs[b]
100 for c in ['2008-1514','2008-3528','2008-3831','2009-0029','2008-4395']:
101- cve = lp.load('https://api.edge.launchpad.net/beta/bugs/cve/%s' % (c))
102+ cve = lp.load(str(lp._root_uri) + '/bugs/cve/%s' % (c))
103 print '%s %s' % (b, c)
104 bug.unlinkCVE(cve=cve)