Set private-address on db-router relation

Avoid LP Bug#1917346 when setting MySQL authentication and the expected
IP address for connectivity.

Change-Id: Id7f05dc80ef665d2672f512d191d8fffc0014ec7
Partial-Bug: #1917346
This commit is contained in:
David Ames 2021-03-01 10:17:06 -08:00
parent 6a163e702f
commit f6ebeef9ae
2 changed files with 3 additions and 1 deletions

View File

@ -56,6 +56,7 @@ class MySQLRouterRequires(reactive.RelationBase):
relation_info = {
prefix + '_username': username,
prefix + '_hostname': hostname,
'private-address': hostname,
}
self.set_prefix(prefix)
self.set_remote(**relation_info)

View File

@ -232,7 +232,8 @@ class TestMySQLRouterRequires(unittest.TestCase):
_prefix = "prefix"
_expected = {
"{}_username".format(_prefix): _user,
"{}_hostname".format(_prefix): _host}
"{}_hostname".format(_prefix): _host,
"private-address": _host}
self.mysql_router.configure_db_router(_user, _host, prefix=_prefix)
self.set_remote.assert_called_once_with(**_expected)
self.set_local.assert_called_once_with(**_expected)