Merge lp:~matsubara/lp-devops-dashboard/932768-lplib-credential into lp:lp-devops-dashboard

Proposed by Diogo Matsubara
Status: Merged
Approved by: Diogo Matsubara
Approved revision: 49
Merged at revision: 49
Proposed branch: lp:~matsubara/lp-devops-dashboard/932768-lplib-credential
Merge into: lp:lp-devops-dashboard
Diff against target: 72 lines (+10/-7)
3 files modified
src/devops/fetchbugs.py (+6/-6)
src/devops/generate.py (+1/-1)
src/devops/utils.py (+3/-0)
To merge this branch: bzr merge lp:~matsubara/lp-devops-dashboard/932768-lplib-credential
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Launchpad QA Pending
Review via email: mp+93207@code.launchpad.net

Description of the change

After an update to the download-cache of the devops dashboard, existing launchpadlib credentials weren't used. A new credential file is requested and the existing one ignored. This fix adds the option to use the existing credential file.

Is this the right fix for this issue? Should I get a new credential file using the desktop integration workflow? Is there a way to copy the existing credentials to be used by the desktop workflow?

Thanks!

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Hi Diogo,

On IRC we talked about using this credential file vs. the keyring. But since this is running on devpad it may be hard to actually authenticate in that environment. So I think the changes you've made here are the best way to go.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/devops/fetchbugs.py'
2--- src/devops/fetchbugs.py 2011-06-17 21:36:09 +0000
3+++ src/devops/fetchbugs.py 2012-02-15 14:15:59 +0000
4@@ -1,6 +1,5 @@
5 from launchpadlib.launchpad import Launchpad
6 from datetime import datetime, timedelta, date
7-import pdb
8
9
10 class DayStats:
11@@ -75,10 +74,12 @@
12 u"Fix Released",
13 ]
14
15- def __init__(self, lp_instance="production", lp=None, days_ago=7):
16+ def __init__(self, lp_instance="production", lp=None, days_ago=7,
17+ config=None):
18 self.days_ago = days_ago
19 self.bugs_list = None
20 self.lp_instance = lp_instance
21+ self.config = config
22 try:
23 if lp is None:
24 self.initialize_launchpad()
25@@ -95,10 +96,9 @@
26
27 def initialize_launchpad(self):
28 """Initialize the lp attribute."""
29- lplib_login_func = Launchpad.login_with
30- lplib_user = 'dashboard'
31-
32- self.lp = lplib_login_func(lplib_user, service_root=self.lp_instance)
33+ self.lp = Launchpad.login_with(
34+ 'dashboard', service_root=self.lp_instance,
35+ credentials_file=self.config.lplib_credentials_file)
36
37 def fetch_open_critical_bugs(self):
38 return self.launchpad_project.searchTasks(importance=[u"Critical"])
39
40=== modified file 'src/devops/generate.py'
41--- src/devops/generate.py 2011-06-17 21:36:31 +0000
42+++ src/devops/generate.py 2012-02-15 14:15:59 +0000
43@@ -67,7 +67,7 @@
44 incident_reports = IncidentReports()
45 incident_reports.get_last_reports_since()
46
47- critical_bugs = LaunchpadBugs()
48+ critical_bugs = LaunchpadBugs(config=self.config_)
49 critical_bugs.get_todays_stats()
50 critical_bugs.get_last_days_stats()
51
52
53=== modified file 'src/devops/utils.py'
54--- src/devops/utils.py 2011-04-22 20:11:06 +0000
55+++ src/devops/utils.py 2012-02-15 14:15:59 +0000
56@@ -11,6 +11,7 @@
57 self.config_file_path = config_file_path
58 self.deployment_reports_path = None
59 self.devops_index_path = None
60+ self.lplib_credentials_file = None
61
62 def read_config_file(self):
63 config_parser = ConfigParser()
64@@ -20,6 +21,8 @@
65 "deployment_reports_path")
66 self.devops_index_path = config_parser.get("reports",
67 "generated_report_path")
68+ self.lplib_credentials_file = config_parser.get("credentials",
69+ "lplib_credentials_file")
70
71
72 def days_ago(date):

Subscribers

People subscribed via source and target branches

to all changes: