Esempio n. 1
0
    def _write_mycnf(self, update_memory_mb, admin_password):
        """
        Install the set of mysql my.cnf templates from dbaas-mycnf package.
        The package generates a template suited for the current
        container flavor. 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()

        # As of right here, the admin_password contains the password to be
        # applied to the my.cnf file, whether it was there before (and we
        # passed it in) or we generated a new one just now (because we didn't
        # find it).

        LOG.debug(_("Installing my.cnf templates"))
        pkg.pkg_install("dbaas-mycnf", self.TIME_OUT)

        LOG.info(_("Replacing my.cnf with template."))
        template_path = DBAAS_MYCNF % update_memory_mb
        # replace my.cnf with template.
        self._replace_mycnf_with_template(template_path, ORIG_MYCNF)

        LOG.info(_("Writing new temp my.cnf."))
        self._write_temp_mycnf_with_admin_account(ORIG_MYCNF, TMP_MYCNF, admin_password)
        # permissions work-around
        LOG.info(_("Moving tmp into final."))
        utils.execute_with_timeout("sudo", "mv", TMP_MYCNF, FINAL_MYCNF)
        LOG.info(_("Removing original my.cnf."))
        utils.execute_with_timeout("sudo", "rm", ORIG_MYCNF)
        LOG.info(_("Symlinking final my.cnf."))
        utils.execute_with_timeout("sudo", "ln", "-s", FINAL_MYCNF, ORIG_MYCNF)
        self.wipe_ib_logfiles()
Esempio n. 2
0
 def test_already_instaled(self):
     # test happy path
     pexpect.spawn.expect = Mock(return_value=6)
     pkg.pkg_install(self.pkgName, 5000)
Esempio n. 3
0
 def _install_mysql(self):
     """Install mysql server. The current version is 5.5"""
     LOG.debug(_("Installing mysql server"))
     pkg.pkg_install(self.MYSQL_PACKAGE_VERSION, self.TIME_OUT)
     LOG.debug(_("Finished installing mysql server"))
Esempio n. 4
0
 def test_success_install(self):
     # test
     pexpect.spawn.expect = Mock(return_value=5)
     self.assertTrue(pkg.pkg_install(self.pkgName, 5000) is None)