Skip to content

Commit

Permalink
composer: --no-interaction when discovering available options (#2348)
Browse files Browse the repository at this point in the history
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 eb455c6)
  • Loading branch information
gangelop authored and Patchback committed May 1, 2021
1 parent 51540f6 commit 0a52ee1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion plugins/modules/packaging/language/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a52ee1

Please sign in to comment.