Merge "MySQL do not retrieve Password in get user"

This commit is contained in:
Jenkins 2016-08-12 08:29:01 +00:00 committed by Gerrit Code Review
commit 2a040c2578
2 changed files with 2 additions and 3 deletions

View File

@ -372,7 +372,7 @@ class BaseMySqlAdmin(object):
) )
with self.local_sql_client(self.mysql_app.get_engine()) as client: with self.local_sql_client(self.mysql_app.get_engine()) as client:
q = sql_query.Query() q = sql_query.Query()
q.columns = ['User', 'Host', 'Password'] q.columns = ['User', 'Host']
q.tables = ['mysql.user'] q.tables = ['mysql.user']
q.where = ["Host != 'localhost'", q.where = ["Host != 'localhost'",
"User = '%s'" % username, "User = '%s'" % username,
@ -384,7 +384,6 @@ class BaseMySqlAdmin(object):
if len(result) != 1: if len(result) != 1:
return None return None
found_user = result[0] found_user = result[0]
user.password = found_user['Password']
user.host = found_user['Host'] user.host = found_user['Host']
self._associate_dbs(user) self._associate_dbs(user)
return user return user

View File

@ -727,7 +727,7 @@ class MySqlAdminTest(trove_testtools.TestCase):
username = "user1" username = "user1"
hostname = "%" hostname = "%"
user = [{"User": "user1", "Host": "%", 'Password': 'some_thing'}] user = [{"User": "user1", "Host": "%", 'Password': 'some_thing'}]
expected = ("SELECT User, Host, Password FROM mysql.user " expected = ("SELECT User, Host FROM mysql.user "
"WHERE Host != 'localhost' AND User = 'user1' " "WHERE Host != 'localhost' AND User = 'user1' "
"AND Host = '%' ORDER BY User, Host;") "AND Host = '%' ORDER BY User, Host;")