Merge pull request #1 from modoboa/master

Update
This commit is contained in:
emsit
2015-10-31 13:52:57 +01:00
5 changed files with 20 additions and 4 deletions

View File

@@ -23,3 +23,10 @@ By default, the following components are installed:
* Postfix
* Dovecot
* Amavis (with SpamAssassin and ClamAV)
If you want to follow details of installation process, use --debug
At the end of the process, you should consider updating virus database with this command::
freshclam
/etc/init.d/clamav-daemon restart

View File

@@ -5,6 +5,7 @@ tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
[database]
# Select database engine : postgres or mysql
engine = postgres
#engine = mysql
host = 127.0.0.1
install = true

View File

@@ -45,6 +45,7 @@ class PostgreSQL(Database):
"""Exec a postgresql query."""
cmd = "psql"
if dbname and dbuser:
self._setup_pgpass(dbname, dbuser, dbpassword)
cmd += " -h {} -d {} -U {} -w".format(self.dbhost, dbname, dbuser)
utils.exec_cmd(
"""{} -c "{}" """.format(cmd, query), sudo_user=self.dbuser)

View File

@@ -104,7 +104,8 @@ class Modoboa(base.Installer):
"INSERT INTO lib_parameter (name, value) VALUES ('{0}', '{1}')"
.format(name, value)
)
self.backend._exec_query(query, self.dbname, self.dbuser)
self.backend._exec_query(
query, self.dbname, self.dbuser, self.dbpasswd)
def post_run(self):
"""Additional tasks."""

View File

@@ -48,8 +48,14 @@ class Postfix(base.Installer):
self.dbengine, self.config.get("modoboa", "dbuser"),
self.config.get("modoboa", "dbpassword"),
self.dbhost, self.config.get("modoboa", "dbname"))
extensions = self.config.get("modoboa", "extensions")
exts_with_maps = ["modoboa-admin", "modoboa-admin-relaydomains",
"modoboa-postfix-autoreply"]
extensions = [ext for ext in exts_with_maps if ext in extensions]
if not extensions:
return
cmd = (
"{} {} postfix_maps --dbtype {} --extensions all --dburl {} {}"
.format(python_path, script_path, self.dbengine, db_url,
self.config_dir))
"{} {} postfix_maps --dbtype {} --extensions {} --dburl {} {}"
.format(python_path, script_path, self.dbengine,
" ".join(extensions), db_url, self.config_dir))
utils.exec_cmd(cmd)