Merge branch 'master' of github.com:modoboa/modoboa-installer
This commit is contained in:
@@ -123,9 +123,9 @@ class MySQL(Database):
|
||||
|
||||
packages = {
|
||||
"deb": ["mysql-server", "libmysqlclient-dev"],
|
||||
"rpm": ["mariadb", "mariadb-devel"],
|
||||
"rpm": ["mariadb", "mariadb-devel","mariadb-server"],
|
||||
}
|
||||
service = "mysql"
|
||||
service = "mariadb" if package.backend.FORMAT == "rpm" else "mysql"
|
||||
|
||||
def install_package(self):
|
||||
"""Preseed package installation."""
|
||||
@@ -134,9 +134,11 @@ class MySQL(Database):
|
||||
package.backend.preconfigure(
|
||||
"mysql-server", "root_password_again", "password", self.dbpassword)
|
||||
super(MySQL, self).install_package()
|
||||
if package.backend.FORMAT == "rpm":
|
||||
utils.exec_cmd("mysqladmin -u root password '{}'".format(self.dbpassword))
|
||||
|
||||
def _exec_query(self, query, dbname=None, dbuser=None, dbpassword=None):
|
||||
"""Exec a postgresql query."""
|
||||
"""Exec a mysql query."""
|
||||
if dbuser is None and dbpassword is None:
|
||||
dbuser = self.dbuser
|
||||
dbpassword = self.dbpassword
|
||||
@@ -150,6 +152,9 @@ class MySQL(Database):
|
||||
self._exec_query(
|
||||
"CREATE USER '{}'@'%' IDENTIFIED BY '{}'".format(
|
||||
name, password))
|
||||
self._exec_query(
|
||||
"CREATE USER '{}'@'localhost' IDENTIFIED BY '{}'".format(
|
||||
name, password))
|
||||
|
||||
def create_database(self, name, owner):
|
||||
"""Create a database."""
|
||||
@@ -162,6 +167,9 @@ class MySQL(Database):
|
||||
self._exec_query(
|
||||
"GRANT ALL PRIVILEGES ON {}.* to '{}'@'%'"
|
||||
.format(dbname, user))
|
||||
self._exec_query(
|
||||
"GRANT ALL PRIVILEGES ON {}.* to '{}'@'localhost'"
|
||||
.format(dbname, user))
|
||||
|
||||
def load_sql_file(self, dbname, dbuser, dbpassword, path):
|
||||
"""Load SQL file."""
|
||||
|
||||
@@ -11,6 +11,7 @@ class CertificateBackend(object):
|
||||
def __init__(self, config):
|
||||
"""Set path to certificates."""
|
||||
self.config = config
|
||||
if not config.has_option("general", "tls_key_file"):
|
||||
for base_dir in ["/etc/pki/tls", "/etc/ssl"]:
|
||||
if os.path.exists(base_dir):
|
||||
self.config.set(
|
||||
@@ -21,6 +22,8 @@ class CertificateBackend(object):
|
||||
"{}/certs/%(hostname)s.cert".format(base_dir))
|
||||
return
|
||||
raise RuntimeError("Cannot find a directory to store certificate")
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
class SelfSignedCertificate(CertificateBackend):
|
||||
|
||||
Reference in New Issue
Block a user