Documentation update

This commit is contained in:
Antoine Nguyen
2015-04-08 16:05:53 +02:00
parent 8b4913a566
commit db9b24beb0
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -422,7 +422,7 @@ be used by Postfix to lookup into Modoboa tables.
To automaticaly generate the requested map files and store them in a
directory, run the following command::
$ modoboa-admin.py postfix_maps --dbtype <mysql|postgres|sqlite> --extensions <extension names> <directory>
$ modoboa-admin.py postfix_maps --dbtype <mysql|postgres|sqlite> --extensions all <directory>
``<directory>`` is the directory where the files will be
stored. Answer the few questions and you're done.
+8 -1
View File
@@ -11,6 +11,7 @@ from django.template import Context, Template
import dj_database_url
from modoboa.lib.api_client import ModoAPIClient
from . import Command
MAP_FILE_TEMPLATE = """user = {{ dbuser }}
@@ -85,8 +86,11 @@ class MapFilesGenerator(object):
"""Load specified extensions."""
if "all" in extensions:
# Retrieve extension list from the API
return
official_exts = ModoAPIClient().list_extensions()
extensions = [extension["name"] for extension in official_exts]
for extension in extensions:
extension = extension.replace("-", "_")
try:
__import__(extension, locals(), globals(), ["postfix_maps"])
except ImportError:
@@ -126,6 +130,9 @@ query = {{ query|safe }}
class PostfixMapsCommand(Command):
"""Base command to generate map files."""
help = "Generate ready-to-use postfix map files"
def __init__(self, *args, **kwargs):