Specify router name to allow co-located routers

We were getting "Error: It appears that a router instance named '' has been
previously configured in this host. If that instance no longer exists, use the
--force option to overwrite it." when co-locating mysql-routers. Specify the
name of the mysql-router to allow co-location.

Closes-Bug: #1918726
Change-Id: I65c2730dcb5ffb240bf57c9e0b0cb1a1735a4525
This commit is contained in:
David Ames 2021-03-11 23:06:40 +00:00
parent 80339e4625
commit b370fa3778
2 changed files with 7 additions and 6 deletions

View File

@ -413,6 +413,7 @@ class MySQLRouterCharm(charms_openstack.charm.OpenStackCharm):
"""
cmd = [self.mysqlrouter_bin,
"--user", self.mysqlrouter_user,
"--name", self.name,
"--bootstrap",
"{}:{}@{}".format(self.db_router_user,
self.db_router_password,

View File

@ -387,8 +387,9 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
self.cmp_pkgrevno.return_value = -1
mrc.bootstrap_mysqlrouter()
self.subprocess.check_output.assert_called_once_with(
[mrc.mysqlrouter_bin, "--user", _user, "--bootstrap",
"{}:{}@{}".format(mrc.db_router_user, _pass, _addr),
[mrc.mysqlrouter_bin, "--user", _user, "--name", mrc.name,
"--bootstrap", "{}:{}@{}"
.format(mrc.db_router_user, _pass, _addr),
"--directory", mrc.mysqlrouter_working_dir,
"--conf-use-sockets",
"--conf-bind-address", mrc.shared_db_address,
@ -404,8 +405,9 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
self.cmp_pkgrevno.return_value = 1
mrc.bootstrap_mysqlrouter()
self.subprocess.check_output.assert_called_once_with(
[mrc.mysqlrouter_bin, "--user", _user, "--bootstrap",
"{}:{}@{}".format(mrc.db_router_user, _pass, _addr),
[mrc.mysqlrouter_bin, "--user", _user, "--name", mrc.name,
"--bootstrap", "{}:{}@{}"
.format(mrc.db_router_user, _pass, _addr),
"--directory", mrc.mysqlrouter_working_dir,
"--conf-use-sockets",
"--conf-bind-address", mrc.shared_db_address,
@ -603,7 +605,6 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
def test_update_config_parameters(self):
self.patch_object(mysql_router.configparser, "ConfigParser")
self.service_name = "mysql-router"
_mock_config_parser = mock.MagicMock()
self.ConfigParser.return_value = _mock_config_parser
@ -636,7 +637,6 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
self.patch_object(mysql_router.os_utils, "pausable_restart_on_change")
self.config.side_effect = _fake_config
self.pausable_restart_on_change.return_value = _mock_decorator
self.service_name = "mysql-router"
self.endpoint_from_flag.return_value = self.db_router
self.db_router.ssl_ca.return_value = '"CACERT"'