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

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
This commit is contained in:
George Angelopoulos 2021-05-01 19:23:14 +03:00 committed by GitHub
parent 26c3bd25f6
commit eb455c69a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -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).

View file

@ -169,7 +169,7 @@ def has_changed(string):
def get_available_options(module, command='install'): def get_available_options(module, command='install'):
# get all available options from a composer command using composer help to json # 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: if rc != 0:
output = parse_out(err) output = parse_out(err)
module.fail_json(msg=output) module.fail_json(msg=output)