From 0a52ee19f69e54ddf30811c669ec5040da1d36b9 Mon Sep 17 00:00:00 2001 From: George Angelopoulos Date: Sat, 1 May 2021 19:23:14 +0300 Subject: [PATCH] composer: --no-interaction when discovering available options (#2348) 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) --- ...-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 00000000000..0728aeb28b7 --- /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 c792098b04a..64157cb685a 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)