Do not remove root user on disable
The existence of the root user (with remote access) is used to determine whether root was ever enabled on a restored instance. Do not remove it, just generate a new random password for it. Change-Id: I8a4321ac062b1ec565945b49dbb7c619b6da867f Closes-Bug: 1549600
This commit is contained in:
parent
69c03b9629
commit
52bc1ab9c8
4
releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml
Normal file
4
releasenotes/notes/mysql-root-fix-35079552e25170ca.yaml
Normal file
@ -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
|
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user