diff --git a/changelogs/fragments/1154-django_manage-docs.yml b/changelogs/fragments/1154-django_manage-docs.yml new file mode 100644 index 0000000000..ea9af785dd --- /dev/null +++ b/changelogs/fragments/1154-django_manage-docs.yml @@ -0,0 +1,2 @@ +deprecated_features: + - django_manage - the parameter ``liveserver`` relates to a no longer maintained third-party module for django. It is now deprecated, and will be remove in community.general 3.0.0 (https://github.com/ansible-collections/community.general/pull/1154). diff --git a/plugins/modules/web_infrastructure/django_manage.py b/plugins/modules/web_infrastructure/django_manage.py index 75a40d5592..69bf8680ed 100644 --- a/plugins/modules/web_infrastructure/django_manage.py +++ b/plugins/modules/web_infrastructure/django_manage.py @@ -13,40 +13,50 @@ DOCUMENTATION = ''' module: django_manage short_description: Manages a Django application. description: - - Manages a Django application using the I(manage.py) application frontend to I(django-admin). With the I(virtualenv) parameter, all - management commands will be executed by the given I(virtualenv) installation. + - Manages a Django application using the C(manage.py) application frontend to C(django-admin). With the + C(virtualenv) parameter, all management commands will be executed by the given C(virtualenv) installation. options: command: - choices: [ 'cleanup', 'collectstatic', 'flush', 'loaddata', 'migrate', 'runfcgi', 'syncdb', 'test', 'validate', ] description: - - The name of the Django management command to run. Built in commands are cleanup, collectstatic, flush, loaddata, migrate, runfcgi, syncdb, - test, and validate. - - Other commands can be entered, but will fail if they're unknown to Django. Other commands that may prompt for user input should be run - with the I(--noinput) flag. + - The name of the Django management command to run. Built in commands are C(cleanup), C(collectstatic), + C(flush), C(loaddata), C(migrate), C(syncdb), C(test), and C(validate). + - Other commands can be entered, but will fail if they're unknown to Django. Other commands that may + prompt for user input should be run with the C(--noinput) flag. + - The module will perform some basic parameter validation (when applicable) to the commands C(cleanup), + C(collectstatic), C(createcachetable), C(flush), C(loaddata), C(migrate), C(syncdb), C(test), and C(validate). + type: str required: true app_path: description: - The path to the root of the Django application where B(manage.py) lives. + type: path required: true settings: description: - - The Python path to the application's settings module, such as 'myapp.settings'. + - The Python path to the application's settings module, such as C(myapp.settings). + type: path required: false pythonpath: description: - - A directory to add to the Python path. Typically used to include the settings module if it is located external to the application directory. + - A directory to add to the Python path. Typically used to include the settings module if it is located + external to the application directory. + type: path required: false + aliases: [python_path] virtualenv: description: - An optional path to a I(virtualenv) installation to use while running the manage application. - aliases: [virtualenv] + type: path + aliases: [virtual_env] apps: description: - - A list of space-delimited apps to target. Used by the 'test' command. + - A list of space-delimited apps to target. Used by the C(test) command. + type: str required: false cache_table: description: - - The name of the table used for database-backed caching. Used by the 'createcachetable' command. + - The name of the table used for database-backed caching. Used by the C(createcachetable) command. + type: str required: false clear: description: @@ -57,41 +67,66 @@ options: type: bool database: description: - - The database to target. Used by the C(createcachetable), C(flush), C(loaddata), C(syncdb), and C(migrate) I(command). + - The database to target. Used by the C(createcachetable), C(flush), C(loaddata), C(syncdb), + and C(migrate) commands. + type: str required: false failfast: description: - - Fail the command immediately if a test fails. Used by the 'test' command. + - Fail the command immediately if a test fails. Used by the C(test) command. required: false - default: "no" + default: false type: bool + aliases: [fail_fast] fixtures: description: - - A space-delimited list of fixture file names to load in the database. B(Required) by the 'loaddata' command. + - A space-delimited list of fixture file names to load in the database. B(Required) by the C(loaddata) command. + type: str required: false skip: description: - - Will skip over out-of-order missing migrations, you can only use this parameter with I(migrate) + - Will skip over out-of-order missing migrations, you can only use this parameter with C(migrate) command. required: false type: bool merge: description: - - Will run out-of-order or missing migrations as they are not rollback migrations, you can only use this parameter with 'migrate' command + - Will run out-of-order or missing migrations as they are not rollback migrations, you can only use this + parameter with C(migrate) command. required: false type: bool link: description: - - Will create links to the files instead of copying them, you can only use this parameter with 'collectstatic' command + - Will create links to the files instead of copying them, you can only use this parameter with + C(collectstatic) command. required: false type: bool + liveserver: + description: + - This parameter was implemented a long time ago in a galaxy far way. It probably relates to the + django-liveserver package, which is no longer updated. + - Hence, it will be considered DEPRECATED and should be removed in a future release. + type: str + required: false + aliases: [live_server] + testrunner: + description: + - "From the Django docs: Controls the test runner class that is used to execute tests." + - This parameter is passed as-is to C(manage.py). + type: str + required: false + aliases: [test_runner] notes: - - I(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the virtualenv parameter is specified. - - This module will create a virtualenv if the virtualenv parameter is specified and a virtualenv does not already exist at the given location. - - This module assumes English error messages for the 'createcachetable' command to detect table existence, unfortunately. - - To be able to use the migrate command with django versions < 1.7, you must have south installed and added as an app in your settings. - - To be able to use the collectstatic command, you must have enabled staticfiles in your settings. - - As of ansible 2.x, your I(manage.py) application must be executable (rwxr-xr-x), and must have a valid I(shebang), i.e. "#!/usr/bin/env python", - for invoking the appropriate Python interpreter. + - C(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the virtualenv parameter + is specified. + - This module will create a virtualenv if the virtualenv parameter is specified and a virtualenv does not already + exist at the given location. + - This module assumes English error messages for the C(createcachetable) command to detect table existence, + unfortunately. + - To be able to use the C(migrate) command with django versions < 1.7, you must have C(south) installed and added + as an app in your settings. + - To be able to use the C(collectstatic) command, you must have enabled staticfiles in your settings. + - Your C(manage.py) application must be executable (rwxr-xr-x), and must have a valid shebang, + i.e. C(#!/usr/bin/env python), for invoking the appropriate Python interpreter. requirements: [ "virtualenv", "django" ] author: "Scott Anderson (@tastychutney)" ''' @@ -154,7 +189,6 @@ def _ensure_virtualenv(module): if not os.path.exists(activate): virtualenv = module.get_bin_path('virtualenv', True) - vcmd = '%s %s' % (virtualenv, venv_param) vcmd = [virtualenv, venv_param] rc, out_venv, err_venv = module.run_command(vcmd) if rc != 0: @@ -177,11 +211,14 @@ def loaddata_filter_output(line): def syncdb_filter_output(line): - return ("Creating table " in line) or ("Installed" in line and "Installed 0 object" not in line) + return ("Creating table " in line) \ + or ("Installed" in line and "Installed 0 object" not in line) def migrate_filter_output(line): - return ("Migrating forwards " in line) or ("Installed" in line and "Installed 0 object" not in line) or ("Applying" in line) + return ("Migrating forwards " in line) \ + or ("Installed" in line and "Installed 0 object" not in line) \ + or ("Applying" in line) def collectstatic_filter_output(line): @@ -224,20 +261,21 @@ def main(): module = AnsibleModule( argument_spec=dict( - command=dict(default=None, required=True), - app_path=dict(default=None, required=True, type='path'), - settings=dict(default=None, required=False), - pythonpath=dict(default=None, required=False, aliases=['python_path']), + command=dict(required=True, type='str'), + app_path=dict(required=True, type='path'), + settings=dict(default=None, required=False, type='path'), + pythonpath=dict(default=None, required=False, type='path', aliases=['python_path']), virtualenv=dict(default=None, required=False, type='path', aliases=['virtual_env']), apps=dict(default=None, required=False), - cache_table=dict(default=None, required=False), + cache_table=dict(default=None, required=False, type='str'), clear=dict(default=None, required=False, type='bool'), - database=dict(default=None, required=False), + database=dict(default=None, required=False, type='str'), failfast=dict(default=False, required=False, type='bool', aliases=['fail_fast']), - fixtures=dict(default=None, required=False), - liveserver=dict(default=None, required=False, aliases=['live_server']), - testrunner=dict(default=None, required=False, aliases=['test_runner']), + fixtures=dict(default=None, required=False, type='str'), + liveserver=dict(default=None, required=False, type='str', aliases=['live_server'], + removed_in_version='3.0.0', removed_from_collection='community.general'), + testrunner=dict(default=None, required=False, type='str', aliases=['test_runner']), skip=dict(default=None, required=False, type='bool'), merge=dict(default=None, required=False, type='bool'), link=dict(default=None, required=False, type='bool'), diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index a40cb1bf75..49bc15a528 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1231,11 +1231,6 @@ plugins/modules/web_infrastructure/apache2_module.py validate-modules:parameter- plugins/modules/web_infrastructure/deploy_helper.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/deploy_helper.py validate-modules:parameter-type-not-in-doc plugins/modules/web_infrastructure/deploy_helper.py validate-modules:undocumented-parameter -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-missing-type -plugins/modules/web_infrastructure/django_manage.py validate-modules:no-default-for-required-parameter -plugins/modules/web_infrastructure/django_manage.py validate-modules:parameter-type-not-in-doc -plugins/modules/web_infrastructure/django_manage.py validate-modules:undocumented-parameter plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:doc-required-mismatch plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:parameter-type-not-in-doc diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index a40cb1bf75..49bc15a528 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -1231,11 +1231,6 @@ plugins/modules/web_infrastructure/apache2_module.py validate-modules:parameter- plugins/modules/web_infrastructure/deploy_helper.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/deploy_helper.py validate-modules:parameter-type-not-in-doc plugins/modules/web_infrastructure/deploy_helper.py validate-modules:undocumented-parameter -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-missing-type -plugins/modules/web_infrastructure/django_manage.py validate-modules:no-default-for-required-parameter -plugins/modules/web_infrastructure/django_manage.py validate-modules:parameter-type-not-in-doc -plugins/modules/web_infrastructure/django_manage.py validate-modules:undocumented-parameter plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:doc-required-mismatch plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:parameter-type-not-in-doc diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 72a5954bed..2f17ba269e 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -962,11 +962,6 @@ plugins/modules/web_infrastructure/apache2_module.py validate-modules:doc-missin plugins/modules/web_infrastructure/apache2_module.py validate-modules:parameter-type-not-in-doc plugins/modules/web_infrastructure/deploy_helper.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/deploy_helper.py validate-modules:parameter-type-not-in-doc -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/web_infrastructure/django_manage.py validate-modules:doc-missing-type -plugins/modules/web_infrastructure/django_manage.py validate-modules:no-default-for-required-parameter -plugins/modules/web_infrastructure/django_manage.py validate-modules:parameter-type-not-in-doc -plugins/modules/web_infrastructure/django_manage.py validate-modules:undocumented-parameter plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:doc-missing-type plugins/modules/web_infrastructure/ejabberd_user.py validate-modules:parameter-type-not-in-doc plugins/modules/web_infrastructure/gunicorn.py validate-modules:parameter-type-not-in-doc