mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 15:04:02 -07:00
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
django module, module_utils: adjustments (#10684)
* django module, module_utils: adjustments
* fix name
* more fixes
* more fixes
* further simplification
* add changelog frag
(cherry picked from commit ded43714d3
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
76 lines
2 KiB
Python
76 lines
2 KiB
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
# Copyright (c) 2024, Alexei Znamensky <russoz@gmail.com>
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
__metaclass__ = type
|
|
|
|
DOCUMENTATION = r"""
|
|
module: django_createcachetable
|
|
author:
|
|
- Alexei Znamensky (@russoz)
|
|
short_description: Wrapper for C(django-admin createcachetable)
|
|
version_added: 9.1.0
|
|
description:
|
|
- This module is a wrapper for the execution of C(django-admin createcachetable).
|
|
extends_documentation_fragment:
|
|
- community.general.attributes
|
|
- community.general.django
|
|
- community.general.django.database
|
|
attributes:
|
|
check_mode:
|
|
support: full
|
|
diff_mode:
|
|
support: none
|
|
"""
|
|
|
|
EXAMPLES = r"""
|
|
- name: Create cache table in the default database
|
|
community.general.django_createcachetable:
|
|
settings: myproject.settings
|
|
|
|
- name: Create cache table in the other database
|
|
community.general.django_createcachetable:
|
|
database: myotherdb
|
|
settings: fancysite.settings
|
|
pythonpath: /home/joedoe/project/fancysite
|
|
venv: /home/joedoe/project/fancysite/venv
|
|
"""
|
|
|
|
RETURN = r"""
|
|
run_info:
|
|
description: Command-line execution information.
|
|
type: dict
|
|
returned: success and O(verbosity) >= 3
|
|
version:
|
|
description: Version of Django.
|
|
type: str
|
|
returned: always
|
|
sample: 5.1.2
|
|
version_added: 10.0.0
|
|
"""
|
|
|
|
from ansible_collections.community.general.plugins.module_utils.django import DjangoModuleHelper
|
|
|
|
|
|
class DjangoCreateCacheTable(DjangoModuleHelper):
|
|
module = dict(
|
|
supports_check_mode=True,
|
|
)
|
|
django_admin_cmd = "createcachetable"
|
|
django_admin_arg_order = "noinput database_dash dry_run"
|
|
_django_args = ["database_dash"]
|
|
_check_mode_arg = "dry_run"
|
|
|
|
def __init_module__(self):
|
|
self.vars.set("database_dash", self.vars.database, output=False)
|
|
|
|
|
|
def main():
|
|
DjangoCreateCacheTable.execute()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|