From dd25c0d3bfcd2a41a8ec6970180c16caa04087b9 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Tue, 7 Sep 2021 16:22:46 +1200 Subject: [PATCH] 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 Co-authored-by: Felix Fontein --- .../fragments/3334-django_manage-split-params.yaml | 2 ++ plugins/modules/web_infrastructure/django_manage.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/3334-django_manage-split-params.yaml diff --git a/changelogs/fragments/3334-django_manage-split-params.yaml b/changelogs/fragments/3334-django_manage-split-params.yaml new file mode 100644 index 0000000000..38ec68a532 --- /dev/null +++ b/changelogs/fragments/3334-django_manage-split-params.yaml @@ -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). diff --git a/plugins/modules/web_infrastructure/django_manage.py b/plugins/modules/web_infrastructure/django_manage.py index 0c8126c457..4ced7452bb 100644 --- a/plugins/modules/web_infrastructure/django_manage.py +++ b/plugins/modules/web_infrastructure/django_manage.py @@ -62,7 +62,7 @@ options: clear: description: - 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 default: no type: bool @@ -109,9 +109,9 @@ options: required: false aliases: [test_runner] 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. - - 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. - This module assumes English error messages for the C(createcachetable) command to detect table existence, unfortunately. @@ -306,7 +306,10 @@ def main(): # these params always get tacked on the end of the command for param in end_of_command_params: if module.params[param]: - run_cmd_args.append(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]) rc, out, err = module.run_command(run_cmd_args, cwd=project_path) if rc != 0: