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
=== modified file 'bug-report-framework/bugs-since-sometime.py'
--- bug-report-framework/bugs-since-sometime.py 2010-02-25 21:06:52 +0000
+++ bug-report-framework/bugs-since-sometime.py 2010-03-31 18:50:42 +0000
@@ -54,7 +54,7 @@
5454
55bugcontrol = launchpad.people['ubuntu-bugcontrol']55bugcontrol = launchpad.people['ubuntu-bugcontrol']
5656
57primary = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+archive/primary')57primary = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+archive/primary')
5858
59importances = { 'Critical':1, 'High':2, 'Medium':3, 'Low':4, 'Wishlist':5, 'Undecided':6 }59importances = { 'Critical':1, 'High':2, 'Medium':3, 'Low':4, 'Wishlist':5, 'Undecided':6 }
6060
6161
=== modified file 'bugs-mailinglist/ml-fixes-report'
--- bugs-mailinglist/ml-fixes-report 2010-03-31 16:37:16 +0000
+++ bugs-mailinglist/ml-fixes-report 2010-03-31 18:50:42 +0000
@@ -70,7 +70,7 @@
70 if bug_number in bug_numbers:70 if bug_number in bug_numbers:
71 continue71 continue
72 try:72 try:
73 task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))73 task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
74 bug = launchpad.bugs[bug_number]74 bug = launchpad.bugs[bug_number]
75 except HTTPError, error:75 except HTTPError, error:
76 print "There was an error with LP: #%s: %s" % (bug_number, error)76 print "There was an error with LP: #%s: %s" % (bug_number, error)
@@ -119,7 +119,7 @@
119 print "There was an error with bug LP: #%s: %s" % (bug_number, error.content)119 print "There was an error with bug LP: #%s: %s" % (bug_number, error.content)
120 bug_numbers.append(bug_number)120 bug_numbers.append(bug_number)
121 121
122 #task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))122 #task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
123 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )123 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )
124 #if task.date_created is None and task.date_fix_released is None:124 #if task.date_created is None and task.date_fix_released is None:
125 #print "\tProbable incorrect bug number in changelog!"125 #print "\tProbable incorrect bug number in changelog!"
126126
=== modified file 'bugs-mailinglist/ml-team-fixes-report'
--- bugs-mailinglist/ml-team-fixes-report 2010-03-31 16:37:16 +0000
+++ bugs-mailinglist/ml-team-fixes-report 2010-03-31 18:50:42 +0000
@@ -76,7 +76,7 @@
76 if fixer not in team_members:76 if fixer not in team_members:
77 continue77 continue
78 try:78 try:
79 task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))79 task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug_number ))
80 bug = launchpad.bugs[bug_number]80 bug = launchpad.bugs[bug_number]
81 except HTTPError, error:81 except HTTPError, error:
82 print "There was an error with LP: #%s: %s" % (bug_number, error)82 print "There was an error with LP: #%s: %s" % (bug_number, error)
@@ -126,7 +126,7 @@
126 print "There was an error with bug LP: #%s: %s" % (bug_number, error)126 print "There was an error with bug LP: #%s: %s" % (bug_number, error)
127 bug_numbers.append(bug_number)127 bug_numbers.append(bug_number)
128128
129 #task = launchpad.load('https://api.edge.launchpad.net/beta/ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))129 #task = launchpad.load(str(launchpad._root_uri) + 'ubuntu/+source/%s/+bug/%s' % ( sourcepackage, bug ))
130 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )130 #print "LP: #%s %s task was fixed by %s in %s" % ( bug, sourcepackage, fixer, distribution )
131 #if task.date_created is None and task.date_fix_released is None:131 #if task.date_created is None and task.date_fix_released is None:
132 #print "\tProbable incorrect bug number in changelog!"132 #print "\tProbable incorrect bug number in changelog!"
133133
=== modified file 'launchpadlib-scripts/bugsquad-membership.py'
--- launchpadlib-scripts/bugsquad-membership.py 2010-03-01 17:38:42 +0000
+++ launchpadlib-scripts/bugsquad-membership.py 2010-03-31 18:50:42 +0000
@@ -45,7 +45,7 @@
45expiration_date = future.strftime("%Y-%m-%d")45expiration_date = future.strftime("%Y-%m-%d")
4646
47if person.is_ubuntu_coc_signer:47if person.is_ubuntu_coc_signer:
48 member_detail = launchpad.load('https://api.edge.launchpad.net/beta/~bugsquad/+member/%s' % lpid)48 member_detail = launchpad.load(str(launchpad._root_uri) + '~bugsquad/+member/%s' % lpid)
49 if member_detail.status == 'Proposed':49 if member_detail.status == 'Proposed':
50 # approving a member will use the default expiration date set for the team which is good50 # approving a member will use the default expiration date set for the team which is good
51 try:51 try:
5252
=== modified file 'launchpadlib-scripts/packages-without-subscribers.py'
--- launchpadlib-scripts/packages-without-subscribers.py 2010-01-05 03:28:06 +0000
+++ launchpadlib-scripts/packages-without-subscribers.py 2010-03-31 18:50:42 +0000
@@ -8,7 +8,8 @@
8# Find packages that do not have any subscribers8# Find packages that do not have any subscribers
9# and may be neglected9# and may be neglected
1010
11from launchpadlib.launchpad import Launchpad, EDGE_SERVICE_ROOT, STAGING_SERVICE_ROOT11from launchpadlib.launchpad import Launchpad
12from launchpadlib.uris import LPNET_SERVICE_ROOT
12from launchpadlib.errors import HTTPError13from launchpadlib.errors import HTTPError
13from launchpadlib.credentials import Credentials14from launchpadlib.credentials import Credentials
1415
@@ -23,7 +24,7 @@
2324
24credfile = os.path.expanduser('~/.launchpadlib/%s.cred' % script_name)25credfile = os.path.expanduser('~/.launchpadlib/%s.cred' % script_name)
2526
26root = 'https://api.launchpad.net/beta/'27root = LPNET_SERVICE_ROOT
2728
28try:29try:
29 credentials = Credentials()30 credentials = Credentials()
3031
=== modified file 'responses/security/unlinkcves'
--- responses/security/unlinkcves 2009-03-30 18:14:45 +0000
+++ responses/security/unlinkcves 2010-03-31 18:50:42 +0000
@@ -14,6 +14,6 @@
14for b in ['157919','209901','246067']:14for b in ['157919','209901','246067']:
15 bug = lp.bugs[b]15 bug = lp.bugs[b]
16 for c in ['2008-1514','2008-3528','2008-3831','2009-0029','2008-4395']:16 for c in ['2008-1514','2008-3528','2008-3831','2009-0029','2008-4395']:
17 cve = lp.load('https://api.edge.launchpad.net/beta/bugs/cve/%s' % (c))17 cve = lp.load(str(lp._root_uri) + '/bugs/cve/%s' % (c))
18 print '%s %s' % (b, c)18 print '%s %s' % (b, c)
19 bug.unlinkCVE(cve=cve)19 bug.unlinkCVE(cve=cve)