Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #2348/eb455c69 backport][stable-2] composer: always use --no-interaction option #2402

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented May 1, 2021

This is a backport of PR #2348 as merged into main (eb455c6).

SUMMARY

Since the composer command provides a no-interaction option, and since
we always call it non-interactively, we should always use it.

The lack of this option caused composer to not exit at least in one
instance when called as 'php /usr/local/bin/composer help install'.
The '-n' added with this patch resolved that issue.

ISSUE TYPE
  • Bugfix Pull Request
    As far as I can tell from the open issues, I'm the first one to report this.
COMPONENT NAME
  • composer
ADDITIONAL INFORMATION

Versions and stuff.

On host:

$ uname -a
Linux pi 5.4.0-1034-raspi #37-Ubuntu SMP PREEMPT Mon Apr 12 23:14:49 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

$ php7.4 -v
PHP 7.4.16 (cli) (built: Mar  5 2021 07:54:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

$ php7.4 /usr/local/bin/composer -V
Composer version 2.0.12 2021-04-01 10:14:59

On controller:

$ ansible --version
ansible 2.10.8
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/george/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /bin/ansible
  python version = 3.9.3 (default, Apr  8 2021, 23:35:02) [GCC 10.2.0]

Output of composer showing the -n option:

php7.4 /usr/local/bin/composer help 
Usage:
  help [options] [--] [<command_name>]

Arguments:
  command                        The command to execute
  command_name                   The command name [default: "help"]

Options:
      --xml                      To output help as XML
      --format=FORMAT            The output format (txt, xml, json, or md) [default: "txt"]
      --raw                      To output raw command help
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      --no-cache                 Prevent use of the cache
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  The help command displays help for a given command:
  
    php /usr/local/bin/composer help list
  
  You can also output the help in other formats by using the --format option:
  
    php /usr/local/bin/composer help --format=xml list
  
  To display the list of available commands, please use the list command.

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)
@ansibullbot
Copy link
Collaborator

cc @dmtrs
click here for bot help

@ansibullbot ansibullbot added affects_2.10 bug This issue/PR relates to a bug community_review language module module needs_triage new_contributor Help guide this first time contributor packaging plugins plugin (any type) python3 small_patch Hopefully easy to review labels May 1, 2021
@felixfontein felixfontein merged commit 7b2853d into stable-2 May 1, 2021
@felixfontein felixfontein deleted the patchback/backports/stable-2/eb455c69a2c7f7ec28f6162e0c5a34f0bc7932e3/pr-2348 branch May 1, 2021 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug community_review language module module needs_triage new_contributor Help guide this first time contributor packaging plugins plugin (any type) python3 small_patch Hopefully easy to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants