From 928b5470d4f371b88a2ee41706a7fc4be46ac18e Mon Sep 17 00:00:00 2001 From: hoellen Date: Thu, 24 Jan 2019 22:38:09 +0100 Subject: [PATCH 1/4] fix some cli commands in the docs --- docs/cli.rst | 26 +++++++++++++------------- docs/kubernetes/mailu/index.rst | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index bdf4a6d1..36899801 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -4,11 +4,11 @@ Mailu command line Managing users and aliases can be done from CLI using commands: * alias -* alias_delete +* alias-delete * user -* user_import -* user_delete -* config_update +* user-import +* user-delete +* config-update alias ----- @@ -18,12 +18,12 @@ alias docker-compose exec admin flask mailu alias foo example.net "mail1@example.com,mail2@example.com" -alias_delete +alias-delete ------------ .. code-block:: bash - docker-compose exec admin flask mailu alias_delete foo@example.net + docker-compose exec admin flask mailu alias-delete foo@example.net user ---- @@ -32,30 +32,30 @@ user docker-compose exec admin flask mailu user --hash_scheme='SHA512-CRYPT' myuser example.net 'password123' -user_import +user-import ----------- primary difference with simple `user` command is that password is being imported as a hash - very useful when migrating users from other systems where only hash is known. .. code-block:: bash - docker-compose run --rm admin python manage.py user --hash_scheme='SHA512-CRYPT' myuser example.net '$6$51ebe0cb9f1dab48effa2a0ad8660cb489b445936b9ffd812a0b8f46bca66dd549fea530ce' + docker-compose run --rm admin flask mailu user-import --hash_scheme='SHA512-CRYPT' myuser example.net '$6$51ebe0cb9f1dab48effa2a0ad8660cb489b445936b9ffd812a0b8f46bca66dd549fea530ce' -user_delete +user-delete ------------ .. code-block:: bash - docker-compose exec admin flask mailu user_delete foo@example.net + docker-compose exec admin flask mailu user-delete foo@example.net -config_update +config-update ------------- The sole purpose of this command is for importing users/aliases in bulk and synchronizing DB entries with external YAML template: .. code-block:: bash - cat mail-config.yml | docker-compose exec admin flask mailu config_update --delete_objects + cat mail-config.yml | docker-compose exec admin flask mailu config-update --delete_objects where mail-config.yml looks like: @@ -72,7 +72,7 @@ where mail-config.yml looks like: domain: example.com destination: "user1@example.com,user2@example.com" -without ``--delete_object`` option config_update will only add/update new values but will *not* remove any entries missing in provided YAML input. +without ``--delete_object`` option config-update will only add/update new values but will *not* remove any entries missing in provided YAML input. Users ----- diff --git a/docs/kubernetes/mailu/index.rst b/docs/kubernetes/mailu/index.rst index 0f2451fa..0711abbd 100644 --- a/docs/kubernetes/mailu/index.rst +++ b/docs/kubernetes/mailu/index.rst @@ -128,7 +128,7 @@ And in the pod run the following command. The command uses following entries: .. code-block:: bash - python manage.py admin root example.com password + flask mailu admin root example.com password - ``admin`` Make it an admin user - ``root`` The first part of the e-mail adres (ROOT@example.com) @@ -207,4 +207,4 @@ If the login problem still persists, or more specific, happens now and then and kubectl -n mailu-mailserver get po kubectl -n mailu-mailserver delete po/mailu-imap... -Happy mailing! \ No newline at end of file +Happy mailing! From bc617cf8ec16ebca652b82dbb54cc7a96472451b Mon Sep 17 00:00:00 2001 From: Roman Hoellen Date: Wed, 13 Feb 2019 10:30:08 +0100 Subject: [PATCH 2/4] replace _ with - in cli options --- core/admin/mailu/manage.py | 10 +++++----- docs/cli.rst | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py index 3a8256ad..cbc8b6c9 100644 --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -86,10 +86,10 @@ def user(localpart, domain_name, password, hash_scheme=None): @mailu.command() -@click.option('-n', '--domain_name') -@click.option('-u', '--max_users') -@click.option('-a', '--max_aliases') -@click.option('-q', '--max_quota_bytes') +@click.option('-n', '--domain-name') +@click.option('-u', '--max-users') +@click.option('-a', '--max-aliases') +@click.option('-q', '--max-quota-bytes') @flask_cli.with_appcontext def domain(domain_name, max_users=-1, max_aliases=-1, max_quota_bytes=0): domain = models.Domain.query.get(domain_name) @@ -126,7 +126,7 @@ def user_import(localpart, domain_name, password_hash, hash_scheme = None): @mailu.command() @click.option('-v', '--verbose') -@click.option('-d', '--delete_objects') +@click.option('-d', '--delete-objects') @flask_cli.with_appcontext def config_update(verbose=False, delete_objects=False): """sync configuration with data from YAML-formatted stdin""" diff --git a/docs/cli.rst b/docs/cli.rst index 7328db0f..6fb2a786 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -30,7 +30,8 @@ user .. code-block:: bash - docker-compose exec admin flask mailu user --hash_scheme='SHA512-CRYPT' myuser example.net 'password123' + docker-compose exec admin flask mailu user myuser example.net 'password123' + user-import ----------- @@ -55,7 +56,7 @@ The sole purpose of this command is for importing users/aliases in bulk and sync .. code-block:: bash - cat mail-config.yml | docker-compose exec admin flask mailu config-update --delete_objects + cat mail-config.yml | docker-compose exec -T admin flask mailu config-update --delete-objects where mail-config.yml looks like: @@ -72,7 +73,7 @@ where mail-config.yml looks like: domain: example.com destination: "user1@example.com,user2@example.com" -without ``--delete_object`` option config-update will only add/update new values but will *not* remove any entries missing in provided YAML input. +without ``--delete-object`` option config-update will only add/update new values but will *not* remove any entries missing in provided YAML input. Users ----- From 1dfef1609a0f4c6a9778c49ff4c371e90ff5e20e Mon Sep 17 00:00:00 2001 From: Roman Hoellen Date: Wed, 13 Feb 2019 10:53:40 +0100 Subject: [PATCH 3/4] add domain cli to docs --- core/admin/mailu/manage.py | 6 ++++-- docs/cli.rst | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py index cbc8b6c9..462bce67 100644 --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -64,7 +64,7 @@ def admin(localpart, domain_name, password): @click.argument('localpart') @click.argument('domain_name') @click.argument('password') -@click.argument('hash_scheme') +@click.argument('hash_scheme', required=False) @flask_cli.with_appcontext def user(localpart, domain_name, password, hash_scheme=None): """ Create a user @@ -86,12 +86,14 @@ def user(localpart, domain_name, password, hash_scheme=None): @mailu.command() -@click.option('-n', '--domain-name') +@click.argument('domain_name') @click.option('-u', '--max-users') @click.option('-a', '--max-aliases') @click.option('-q', '--max-quota-bytes') @flask_cli.with_appcontext def domain(domain_name, max_users=-1, max_aliases=-1, max_quota_bytes=0): + """ Create a domain + """ domain = models.Domain.query.get(domain_name) if not domain: domain = models.Domain(name=domain_name) diff --git a/docs/cli.rst b/docs/cli.rst index 6fb2a786..bdd030f9 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -5,6 +5,7 @@ Managing users and aliases can be done from CLI using commands: * alias * alias-delete +* domain * user * user-import * user-delete @@ -25,6 +26,15 @@ alias-delete docker-compose exec admin flask mailu alias-delete foo@example.net + +domain +---- + +.. code-block:: bash + + docker-compose exec admin flask mailu domain example.net + + user ---- From 9dbe623c1885fa2adb8cde39d7258897005f73ad Mon Sep 17 00:00:00 2001 From: Roman Hoellen Date: Wed, 13 Feb 2019 11:02:26 +0100 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c5a25f..c6aed9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ v1.6.1 - unreleased ------------------- - Enhancement: Make Unbound drop privileges after binding to port - Enhancement: Create an Authentication Token with IPv6 address restriction ([#829](https://github.com/Mailu/Mailu/issues/829)) -- Bug: Fix creating new fetched accounts - Enhancement: Missing wildcard option in alias flask command ([#869](https://github.com/Mailu/Mailu/issues/869)) +- Bug: Fix creating new fetched accounts - Bug: Fix poor performance if ANTIVIRUS is configured to none. +- Bug: Rename cli commands and their options (replace "\_" with "-") ([#877](https://github.com/Mailu/Mailu/issues/877)) v1.6.0 - 2019-01-18 -------------------