Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Created July 2, 2013 19:47
Show Gist options
  • Select an option

  • Save hub-cap/5912493 to your computer and use it in GitHub Desktop.

Select an option

Save hub-cap/5912493 to your computer and use it in GitHub Desktop.
def _write_mycnf(self, admin_password, config_location, config_contents):
"""
Install the set of mysql my.cnf templates.
Update the os_admin user and password to the my.cnf
file for direct login from localhost
"""
LOG.info(_("Writing my.cnf templates."))
if admin_password is None:
admin_password = get_auth_password()
tempfile = tempfile.NamedTemporaryFile()
with tempfile as t:
t.write(config_contents)
self._write_temp_mycnf_with_admin_account(config_location,
tempfile.name,
admin_password)
utils.execute_with_timeout("sudo", "mv", tempfile.name,
config_location)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment