Merge ubuntu-qa-website:fix-sync-lp-bugs into ubuntu-qa-website:main

Proposed by Brian Murray
Status: Merged
Merge reported by: Brian Murray
Merged at revision: 8ea481443301e333ba90078c0024271c20006e39
Proposed branch: ubuntu-qa-website:fix-sync-lp-bugs
Merge into: ubuntu-qa-website:main
Diff against target: 95 lines (+17/-17)
2 files modified
scripts/database.conf (+3/-3)
scripts/sync-lp-bugs (+14/-14)
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Tim Andersson Approve
Review via email: mp+458289@code.launchpad.net

Description of the change

The server which is the ISO tracker is now running on uses python3 so sync-lp-bugs need some python3 changes for that. Additionally, postgres is setup to use unix socket authentication so the config file needed changing and the server is listening on port 80 now but a content cache server is providing https.

To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote :

I'm not massively familiar with this repo, but I can see the essence of these changes. My review may not mean much because of that, but regardless, LGTM!

review: Approve
Revision history for this message
Paride Legovini (paride) wrote :

We probably don't need most or all of those str() calls replacing unicode() calls. However they are also not harmful in any way. There is just one that is certainly useless (nit).

Revision history for this message
Paride Legovini (paride) wrote :

Up to you whether investigate if we actually need those str() calls or not.

review: Approve
ubuntu-qa-website:fix-sync-lp-bugs updated
66d442c... by Brian Murray

Remove an unnecessary str call

8ea4814... by Brian Murray

Remove all unnecessary str() calls

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/database.conf b/scripts/database.conf
2index e3399e8..5e8ff24 100644
3--- a/scripts/database.conf
4+++ b/scripts/database.conf
5@@ -1,5 +1,5 @@
6 [database]
7-host = localhost
8-user = dbuser
9-password = dbpassword
10+host =
11+user = qatracker
12+password =
13 database = qatracker
14diff --git a/scripts/sync-lp-bugs b/scripts/sync-lp-bugs
15index 3db9070..8e88410 100755
16--- a/scripts/sync-lp-bugs
17+++ b/scripts/sync-lp-bugs
18@@ -1,4 +1,4 @@
19-#!/usr/bin/python
20+#!/usr/bin/python3
21 # Written by Stephane Graber <stephane.graber@canonical.com>
22
23 # This program is free software; you can redistribute it and/or modify
24@@ -19,7 +19,7 @@ import datetime
25 import logging
26 import os
27 import sys
28-import xmlrpclib
29+import xmlrpc.client
30 from optparse import OptionParser
31 from configobj import ConfigObj
32 from storm.locals import create_database, DateTime, Int, ReferenceSet, Store, \
33@@ -101,7 +101,7 @@ from launchpadlib.credentials import Credentials
34 # Initialize the cache
35 cachedir = ".launchpadlib/cache"
36 if not os.path.exists(cachedir):
37- os.makedirs(cachedir, 0700)
38+ os.makedirs(cachedir, 0o700)
39
40 # Get credential
41 credfile = "sync-lp-bugs.cred"
42@@ -113,7 +113,7 @@ try:
43 except:
44 launchpad = Launchpad.get_token_and_login("sync-lp-bugs",
45 LPNET_SERVICE_ROOT, cachedir)
46- launchpad.credentials.save(open(credfile, "w", 0600))
47+ launchpad.credentials.save(open(credfile, "w", 0o600))
48
49 # Load the configuration
50 config = ConfigObj(args.config)
51@@ -153,12 +153,12 @@ for site in config['sites']:
52
53 site_comment = None
54 site_tags = None
55- site_rpc = xmlrpclib.ServerProxy("https://%s/xmlrpc.php" %
56+ site_rpc = xmlrpc.client.ServerProxy("http://%s/xmlrpc.php" %
57 site_domain).qatracker
58- site_bugurl = "https://%s/qatracker/reports/bugs" % site_domain
59+ site_bugurl = "http://%s/qatracker/reports/bugs" % site_domain
60
61 # Start by looking for the site in the database
62- site_dbrecords = store.find(Site, subdomain=unicode(site_domain))
63+ site_dbrecords = store.find(Site, subdomain=str(site_domain))
64 if site_dbrecords.count() != 1:
65 logging.error("Unable to find site: %s" % site_domain)
66 continue
67@@ -218,21 +218,21 @@ for site in config['sites']:
68
69 if bug_task.assignee:
70 try:
71- bug_assignee = unicode(bug_task.assignee.display_name)
72+ bug_assignee = bug_task.assignee.display_name
73 except:
74 try:
75- bug_assignee = unicode(bug_task.assignee.name)
76+ bug_assignee = bug_task.assignee.name
77 except:
78- bug_assignee = unicode("Unknown")
79+ bug_assignee = ("Unknown")
80 else:
81 bug_assignee = None
82
83 bug_db.originalbug = bug_number
84 bug_db.bugnumber = bug_lp.id
85- bug_db.title = unicode(bug_lp.title)
86- bug_db.product = unicode(bug_task.bug_target_display_name)
87- bug_db.status = unicode(bug_task.status)
88- bug_db.importance = unicode(bug_task.importance)
89+ bug_db.title = bug_lp.title
90+ bug_db.product = bug_task.bug_target_display_name
91+ bug_db.status = bug_task.status
92+ bug_db.importance = bug_task.importance
93 bug_db.assignee = bug_assignee
94 bug_db.duplicatescount = bug_lp.number_of_duplicates
95 bug_db.subscriberscount = len(bug_lp.subscriptions)

Subscribers

People subscribed via source and target branches