From 45343e6bc07a9363b48443357bed924b92bb6bbf Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 18:46:16 +0200 Subject: [PATCH] composer: --no-interaction when discovering available options (#2348) (#2403) The composer module always uses the no-interaction option if it discovers it _after_ calling "composer help ..." but not on the help call itself. The lack of this option caused composer to not exit when called through the ansible module. The same example command when ran interactively does not prompt for user interaction and exits immediately. It is therefore currently unknown why the same command hangs when called through the ansible composer module or even directly with the command module. Example command which hangs: php /usr/local/bin/composer help install --format=json (cherry picked from commit eb455c69a2c7f7ec28f6162e0c5a34f0bc7932e3) Co-authored-by: George Angelopoulos --- ...-composer-no-interaction-option-discovery-to-avoid-hang.yaml | 2 ++ plugins/modules/packaging/language/composer.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2348-composer-no-interaction-option-discovery-to-avoid-hang.yaml diff --git a/changelogs/fragments/2348-composer-no-interaction-option-discovery-to-avoid-hang.yaml b/changelogs/fragments/2348-composer-no-interaction-option-discovery-to-avoid-hang.yaml new file mode 100644 index 0000000000..0728aeb28b --- /dev/null +++ b/changelogs/fragments/2348-composer-no-interaction-option-discovery-to-avoid-hang.yaml @@ -0,0 +1,2 @@ +bugfixes: + - composer - use ``no-interaction`` option when discovering available options to avoid an issue where composer hangs (https://github.com/ansible-collections/community.general/pull/2348). diff --git a/plugins/modules/packaging/language/composer.py b/plugins/modules/packaging/language/composer.py index c792098b04..64157cb685 100644 --- a/plugins/modules/packaging/language/composer.py +++ b/plugins/modules/packaging/language/composer.py @@ -169,7 +169,7 @@ def has_changed(string): def get_available_options(module, command='install'): # get all available options from a composer command using composer help to json - rc, out, err = composer_command(module, "help %s --format=json" % command) + rc, out, err = composer_command(module, "help %s" % command, arguments="--no-interaction --format=json") if rc != 0: output = parse_out(err) module.fail_json(msg=output)