diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-05-12 21:41:19 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-05-12 21:41:19 +0000 |
commit | c3378b2b0ba128592912d55cce993ae04fa4e75b (patch) | |
tree | f9589991b1c7177762ffa69cd1823f8c9445fa22 | |
parent | 97c69d0537c55f7c0a7727028579a83e8e35dac6 (diff) | |
parent | 0c64fc64d8cff59d24b4883b9057de3fe8e2a224 (diff) | |
download | trove-c3378b2b0ba128592912d55cce993ae04fa4e75b.tar.gz |
Merge "Do not remove root user on disable" into stable/mitaka
-rw-r--r-- | releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml | 4 | ||||
-rw-r--r-- | trove/guestagent/datastore/mysql_common/service.py | 5 | ||||
-rw-r--r-- | trove/tests/unittests/guestagent/test_dbaas.py | 15 |
3 files changed, 12 insertions, 12 deletions
diff --git a/releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml b/releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml new file mode 100644 index 00000000..0033696d --- /dev/null +++ b/releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Do not remove MySQL root user on root-disable so that the + proper status can be reported on restore. Bug 1549600 diff --git a/trove/guestagent/datastore/mysql_common/service.py b/trove/guestagent/datastore/mysql_common/service.py index 90a83ee2..e438116a 100644 --- a/trove/guestagent/datastore/mysql_common/service.py +++ b/trove/guestagent/datastore/mysql_common/service.py @@ -1062,7 +1062,6 @@ class BaseMySqlRootAccess(object): return user.serialize() def disable_root(self): - """Disable the root user global access + """Reset the root password to an unknown value. """ - with self.local_sql_client(self.mysql_app.get_engine()) as client: - client.execute(text(sql_query.REMOVE_ROOT)) + self.enable_root(root_password=None) diff --git a/trove/tests/unittests/guestagent/test_dbaas.py b/trove/tests/unittests/guestagent/test_dbaas.py index f3c368bf..a41c05de 100644 --- a/trove/tests/unittests/guestagent/test_dbaas.py +++ b/trove/tests/unittests/guestagent/test_dbaas.py @@ -42,7 +42,6 @@ from trove.conductor import api as conductor_api from trove.guestagent.common.configuration import ConfigurationManager from trove.guestagent.common.configuration import ImportOverrideStrategy from trove.guestagent.common import operating_system -from trove.guestagent.common import sql_query from trove.guestagent.datastore.experimental.cassandra import ( service as cass_service) from trove.guestagent.datastore.experimental.couchbase import ( @@ -1669,14 +1668,12 @@ class MySqlRootStatusTest(trove_testtools.TestCase): mock_execute.assert_any_call(TextClauseMatcher( 'UPDATE mysql.user')) - def test_root_disable(self): - with patch.object(self.mock_client, - 'execute', return_value=None) as mock_execute: - # invocation - MySqlRootAccess().disable_root() - # verification - mock_execute.assert_any_call(TextClauseMatcher( - sql_query.REMOVE_ROOT)) + @patch.object(MySqlRootAccess, 'enable_root') + def test_root_disable(self, enable_root_mock): + # invocation + MySqlRootAccess().disable_root() + # verification + enable_root_mock.assert_called_once_with(root_password=None) class MockStats: |