[GH-ISSUE #2737] modo management command does not support Django default args (notably --verbosity) #1692

Closed
opened 2026-02-27 11:18:35 +03:00 by kerem · 5 comments
Owner

Originally created by @bernd-wechner on GitHub (Jan 3, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2737

Impacted versions

  • Modoboa: 2.0.3

Current behavior

try this:

Unknown command: '--verbosity'
Type 'manage.py help' for usage.

Expected behavior

Expect all commands and subcommands to honor the tips provided by help:

 python manage.py help modo
usage: manage.py modo [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] {export,import,check_mx,manage_dkim_keys,repair} ...

Modoboa top management command.

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.

subcommands:
  {export,import,check_mx,manage_dkim_keys,repair}
    export              Export domains or identities using CSV format
    import              Import identities from a csv file
    check_mx            Check defined domains.
    manage_dkim_keys
    repair              Check and fix known problems.

That includes -v

I haven't tried others, but expect they too got lost in the process.

Originally created by @bernd-wechner on GitHub (Jan 3, 2023). Original GitHub issue: https://github.com/modoboa/modoboa/issues/2737 # Impacted versions * Modoboa: 2.0.3 # Current behavior try this: ```$ python manage.py --verbosity 3 modo Unknown command: '--verbosity' Type 'manage.py help' for usage. ``` # Expected behavior Expect all commands and subcommands to honor the tips provided by help: ``` python manage.py help modo usage: manage.py modo [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] {export,import,check_mx,manage_dkim_keys,repair} ... Modoboa top management command. options: -h, --help show this help message and exit --version show program's version number and exit -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks. subcommands: {export,import,check_mx,manage_dkim_keys,repair} export Export domains or identities using CSV format import Import identities from a csv file check_mx Check defined domains. manage_dkim_keys repair Check and fix known problems. ``` That includes `-v` I haven't tried others, but expect they too got lost in the process.
kerem 2026-02-27 11:18:35 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@Spitfireap commented on GitHub (Jan 4, 2023):

Hi,
I have just tested it and if I put --verbosity after the subcommand, it doesn't get recognized, while it does if it is place before the subcommand. This is because manage_dkim_keys do not have any arguments... Can you confirm it is the same on your side ?

<!-- gh-comment-id:1370752492 --> @Spitfireap commented on GitHub (Jan 4, 2023): Hi, I have just tested it and if I put `--verbosity` **after** the subcommand, it doesn't get recognized, while it does if it is place before the subcommand. This is because `manage_dkim_keys` do not have any arguments... Can you confirm it is the same on your side ?
Author
Owner

@bernd-wechner commented on GitHub (Jan 4, 2023):

Can you clarify your meaning, as I think there's a typo, you said it both does work and doesn't work after the subcommand. My results from a try just now are:

  • python manage.py --verbosity 3 modo manage_dkim_keys returns Unknown command: '--verbosity' which it should not (bug)
  • python manage.py modo --verbosity 3 manage_dkim_keys does work and sets the option verbosity to 3 in the handler.
  • python manage.py modo manage_dkim_keys --verbosity 3 returns manage.py modo: error: unrecognized arguments: --verbosity 3 which it should not (bug)

Looks like one combo does work, but two do not. I would never have guess that middle one to be hones and command line options shoudl work regardless of placement.

<!-- gh-comment-id:1370764818 --> @bernd-wechner commented on GitHub (Jan 4, 2023): Can you clarify your meaning, as I think there's a typo, you said it both does work and doesn't work after the subcommand. My results from a try just now are: - `python manage.py --verbosity 3 modo manage_dkim_keys` returns `Unknown command: '--verbosity'` which it should not (bug) - `python manage.py modo --verbosity 3 manage_dkim_keys` does work and sets the option `verbosity` to 3 in the handler. - `python manage.py modo manage_dkim_keys --verbosity 3` returns `manage.py modo: error: unrecognized arguments: --verbosity 3` which it should not (bug) Looks like one combo does work, but two do not. I would never have guess that middle one to be hones and command line options shoudl work regardless of placement.
Author
Owner

@Spitfireap commented on GitHub (Jan 4, 2023):

Yes, sorry, I corrected it.

  • python manage.py --verbosity 3 modo manage_dkim_keys returns Unknown command: '--verbosity' which it should not (bug)

I agree that this one should work.

  • python manage.py modo manage_dkim_keys --verbosity 3 returns manage.py modo: error: unrecognized arguments: --verbosity 3 which it should not (bug)

This one I'm not sure : /srv/modoboa/env/bin/python ./manage.py modo manage_dkim_keys -h return basically nothing (because manage_dkim_keys do not support any argument, actually).

<!-- gh-comment-id:1370774513 --> @Spitfireap commented on GitHub (Jan 4, 2023): Yes, sorry, I corrected it. > * `python manage.py --verbosity 3 modo manage_dkim_keys` returns `Unknown command: '--verbosity'` which it should not (bug) I agree that this one *should* work. > * `python manage.py modo manage_dkim_keys --verbosity 3` returns `manage.py modo: error: unrecognized arguments: --verbosity 3` which it should not (bug) This one I'm not sure : `/srv/modoboa/env/bin/python ./manage.py modo manage_dkim_keys -h` return basically nothing (because manage_dkim_keys do not support any argument, actually).
Author
Owner

@bernd-wechner commented on GitHub (Jan 5, 2023):

because manage_dkim_keys do not support any argument, actually

I would argue it should, as a mantra all commands and subcommands should be supporting the standard command line options Django provides (like --verbosity and --help). I don't see it as any overhead to do so, rather an oversight not to.

<!-- gh-comment-id:1371930283 --> @bernd-wechner commented on GitHub (Jan 5, 2023): > because manage_dkim_keys do not support any argument, actually I would argue it should, as a mantra all commands and subcommands should be supporting the standard command line options Django provides (like --verbosity and --help). I don't see it as any overhead to do so, rather an oversight not to.
Author
Owner

@stale[bot] commented on GitHub (Mar 11, 2023):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

<!-- gh-comment-id:1464915748 --> @stale[bot] commented on GitHub (Mar 11, 2023): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1692
No description provided.