← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-rw-main-master-slave into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-rw-main-master-slave into launchpad:master.

Commit message:
Remove old rw_main_{master,slave} config keys

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411335

Our production configs no longer use these names, preferring `rw_main_{primary,standby}`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-rw-main-master-slave into launchpad:master.
diff --git a/lib/lp/services/config/__init__.py b/lib/lp/services/config/__init__.py
index fd6de5c..d96005e 100644
--- a/lib/lp/services/config/__init__.py
+++ b/lib/lp/services/config/__init__.py
@@ -361,16 +361,6 @@ class DatabaseConfig:
             raise AttributeError(name)
         value = None
         for section in sections:
-            # XXX cjwatson 2021-10-01: Remove this once production configs
-            # have been updated to the new name.
-            if name == 'rw_main_primary':
-                value = getattr(section, 'rw_main_master', None)
-                if value is not None:
-                    break
-            elif name == 'rw_main_standby':
-                value = getattr(section, 'rw_main_slave', None)
-                if value is not None:
-                    break
             value = getattr(section, name, None)
             if value is not None:
                 break
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 668b8cf..76ce533 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -542,12 +542,6 @@ timeout: 30
 rw_main_primary: dbname=launchpad_prod_3 host=wildcherry.canonical.com
 # datatype: pgconnection
 rw_main_standby: dbname=launchpad_prod_2 host=chokecherry.canonical.com
-# Deprecated, for compatibility only.  Use rw_main_primary instead.
-# datatype: pgconnection
-rw_main_master: none
-# Deprecated, for compatibility only.  Use rw_main_standby instead.
-# datatype: pgconnection
-rw_main_slave: none
 
 # If the replication lag is more than this many seconds, standby databases
 # will not be used.
diff --git a/lib/lp/services/config/tests/test_database_config.py b/lib/lp/services/config/tests/test_database_config.py
index f43463d..e600b77 100644
--- a/lib/lp/services/config/tests/test_database_config.py
+++ b/lib/lp/services/config/tests/test_database_config.py
@@ -1,12 +1,7 @@
 # Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-from textwrap import dedent
-
-from lp.services.config import (
-    config,
-    DatabaseConfig,
-    )
+from lp.services.config import DatabaseConfig
 from lp.services.propertycache import get_property_cache
 from lp.testing import TestCase
 from lp.testing.layers import DatabaseLayer
@@ -63,29 +58,3 @@ class TestDatabaseConfig(TestCase):
             selected_standby, get_property_cache(dbc).main_standby)
         dbc.reset()
         self.assertEqual(original_standby, dbc.main_standby)
-
-    def test_main_master_compatibility(self):
-        # The old rw_main_master compatibility name works, until such time
-        # as we update production configs to stop using it.
-        config_key = 'old-naming'
-        config.push(config_key, dedent('''\
-            [database]
-            rw_main_master: dbname=launchpad_test_primary port=5433
-            '''))
-        self.addCleanup(config.pop, config_key)
-        dbc = DatabaseConfig()
-        self.assertEqual(
-            'dbname=launchpad_test_primary port=5433', dbc.main_primary)
-
-    def test_main_slave_compatibility(self):
-        # The old rw_main_slave compatibility name works, until such time as
-        # we update production configs to stop using it.
-        config_key = 'old-naming'
-        config.push(config_key, dedent('''\
-            [database]
-            rw_main_slave: dbname=launchpad_test_standby port=5433
-            '''))
-        self.addCleanup(config.pop, config_key)
-        dbc = DatabaseConfig()
-        self.assertEqual(
-            'dbname=launchpad_test_standby port=5433', dbc.main_standby)