← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stub/launchpad/bug-806651-sessiondb-port into lp:launchpad

 

Stuart Bishop has proposed merging lp:~stub/launchpad/bug-806651-sessiondb-port into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #806651 in Launchpad itself: "session database hardcoded to use default postgresql port"
  https://bugs.launchpad.net/launchpad/+bug/806651

For more details, see:
https://code.launchpad.net/~stub/launchpad/bug-806651-sessiondb-port/+merge/67157

Use a full PostgreSQL connection string for the session database instead of old style individual components, allowing the port to be specified.
-- 
https://code.launchpad.net/~stub/launchpad/bug-806651-sessiondb-port/+merge/67157
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/bug-806651-sessiondb-port into lp:launchpad.
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf	2011-06-09 10:50:25 +0000
+++ configs/development/launchpad-lazr.conf	2011-07-07 10:31:31 +0000
@@ -170,7 +170,8 @@
 
 [launchpad_session]
 cookie: launchpad_dev
-dbname: session_dev
+database: dbname=session_dev
+dbname: invalid
 
 [librarian]
 download_url: http://launchpad.dev:58080/

=== modified file 'configs/testrunner/launchpad-lazr.conf'
--- configs/testrunner/launchpad-lazr.conf	2011-03-14 16:24:32 +0000
+++ configs/testrunner/launchpad-lazr.conf	2011-07-07 10:31:31 +0000
@@ -135,7 +135,7 @@
 
 [launchpad_session]
 cookie: launchpad_tests
-dbname: session_ftest
+database: dbname=session_ftest
 
 [librarianlogparser]
 logs_root = lib/canonical/launchpad/scripts/tests/apache-log-files-for-sampledata/

=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf	2011-06-21 12:25:09 +0000
+++ lib/canonical/config/schema-lazr.conf	2011-07-07 10:31:31 +0000
@@ -1270,24 +1270,23 @@
 homepage_recent_posts_count: 6
 
 [launchpad_session]
-# The hostname where the session database is located.
-# If the value is empty or None, localhost via UNIX sockets
-# will be used by the database adapter.
+# datatype: pgconnection
+database: dbname=session_prod host=wildcherry.canonical.com dbuser=session
+
+# The id of the cookie used to store the session token.
+# datatype: string
+cookie: launchpad
+
+# These are unused as of July 2011. Remove when far flung config files
+# have had a chance to remove these entries.
+#
 # datatype: string
 dbhost: none
-
-# The name of the session database.
 # datatype: string
 dbname: session_prod
-
-# The name of the session database user.
 # datatype: string
 dbuser: session
 
-# The id of the cookie used to store the session token.
-# datatype: string
-cookie: launchpad
-
 
 [librarianlogparser]
 logs_root = /srv/launchpadlibrarian.net-logs

=== modified file 'lib/canonical/launchpad/webapp/adapter.py'
--- lib/canonical/launchpad/webapp/adapter.py	2011-02-25 00:17:35 +0000
+++ lib/canonical/launchpad/webapp/adapter.py	2011-07-07 10:31:31 +0000
@@ -514,10 +514,12 @@
     name = 'session'
 
     def raw_connect(self):
-        self._dsn = 'dbname=%s user=%s' % (config.launchpad_session.dbname,
-                                           config.launchpad_session.dbuser)
-        if config.launchpad_session.dbhost:
-            self._dsn += ' host=%s' % config.launchpad_session.dbhost
+        self._dsn = config.launchpad_session.database
+        if not self._dsn:
+            self._dsn = 'dbname=%s user=%s' % (config.launchpad_session.dbname,
+                                            config.launchpad_session.dbuser)
+            if config.launchpad_session.dbhost:
+                self._dsn += ' host=%s' % config.launchpad_session.dbhost
 
         flags = _get_dirty_commit_flags()
         raw_connection = super(LaunchpadSessionDatabase, self).raw_connect()


Follow ups