Fixed restore to work correctly with pexpect

Fixed an issue with restore where it was failing with the latest
version of pexpect in Ubuntu 14.04.

pexpect attempts to stop the temp mysqld process which fails due to
a difference in privilege level (since the process was run with sudo).
We now use mysqladmin shutdown to stop the temp mysqld process.

Closes-Bug: 1343344

Change-Id: Iba81648bb1654db97de876dd9a0dbfb04b8811d1
This commit is contained in:
Nikhil Manchanda 2014-06-13 11:16:00 -07:00
parent eb8cdbcf45
commit 0a7c8d4858
1 changed files with 4 additions and 4 deletions

View File

@ -78,10 +78,10 @@ class MySQLRestoreMixin(object):
"mysqld did not start!"))
LOG.info(_("Root password reset successfully."))
LOG.debug("Cleaning up the temp mysqld process.")
child.delayafterclose = 1
child.delayafterterminate = 1
child.close(force=True)
utils.execute_with_timeout("sudo", "killall", "mysqld")
utils.execute_with_timeout("mysqladmin", "-uroot",
"--protocol=tcp", "shutdown")
utils.execute_with_timeout("killall", "mysqld_safe",
root_helper="sudo", run_as_root=True)
self.poll_until_then_raise(
self.mysql_is_not_running,
base.RestoreError("Reset root password failed: "