diff --git a/doc/integration/imap_and_smtp.rst b/doc/integration/imap_and_smtp.rst index cfcd02ab4..be670a535 100644 --- a/doc/integration/imap_and_smtp.rst +++ b/doc/integration/imap_and_smtp.rst @@ -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 --extensions + $ modoboa-admin.py postfix_maps --dbtype --extensions all ```` is the directory where the files will be stored. Answer the few questions and you're done. diff --git a/modoboa/core/commands/postfix_maps.py b/modoboa/core/commands/postfix_maps.py index f10c6e111..ddcbed991 100644 --- a/modoboa/core/commands/postfix_maps.py +++ b/modoboa/core/commands/postfix_maps.py @@ -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):