1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

django_manage - split params (#3334)

* django_manage - fix fixures

* docs formatting adjustments

* param apps also in need of splitting

* oops, the splitted version was not being properly added to the command args

* added changelog fragment

* check for None

* moving to shlex.split()

* Update changelogs/fragments/3334-django_manage-split-params.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2021-09-07 16:22:46 +12:00 committed by GitHub
parent a20862797e
commit dd25c0d3bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- django_manage - parameters ``apps`` and ``fixtures`` are now splitted instead of being used as a single argument (https://github.com/ansible-collections/community.general/issues/3333).

View file

@ -62,7 +62,7 @@ options:
clear: clear:
description: description:
- Clear the existing files before trying to copy or link the original file. - Clear the existing files before trying to copy or link the original file.
- Used only with the 'collectstatic' command. The C(--noinput) argument will be added automatically. - Used only with the C(collectstatic) command. The C(--noinput) argument will be added automatically.
required: false required: false
default: no default: no
type: bool type: bool
@ -109,9 +109,9 @@ options:
required: false required: false
aliases: [test_runner] aliases: [test_runner]
notes: notes:
- C(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the virtualenv parameter - C(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the I(virtualenv) parameter
is specified. is specified.
- This module will create a virtualenv if the virtualenv parameter is specified and a virtualenv does not already - This module will create a virtualenv if the I(virtualenv) parameter is specified and a virtual environment does not already
exist at the given location. exist at the given location.
- This module assumes English error messages for the C(createcachetable) command to detect table existence, - This module assumes English error messages for the C(createcachetable) command to detect table existence,
unfortunately. unfortunately.
@ -306,6 +306,9 @@ def main():
# these params always get tacked on the end of the command # these params always get tacked on the end of the command
for param in end_of_command_params: for param in end_of_command_params:
if module.params[param]: if module.params[param]:
if param in ('fixtures', 'apps'):
run_cmd_args.extend(shlex.split(module.params[param]))
else:
run_cmd_args.append(module.params[param]) run_cmd_args.append(module.params[param])
rc, out, err = module.run_command(run_cmd_args, cwd=project_path) rc, out, err = module.run_command(run_cmd_args, cwd=project_path)