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

Composer plugin cannot run working_dir dependent commands. e.g. symfony:dump-env #3787

Closed
1 task done
MaPePeR opened this issue Nov 25, 2021 · 6 comments · Fixed by #7405
Closed
1 task done

Composer plugin cannot run working_dir dependent commands. e.g. symfony:dump-env #3787

MaPePeR opened this issue Nov 25, 2021 · 6 comments · Fixed by #7405
Labels
bug This issue/PR relates to a bug has_pr language module module packaging plugins plugin (any type) waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@MaPePeR
Copy link

MaPePeR commented Nov 25, 2021

Summary

When I try to use the symfony:dump-env composer command I get an error that the command does not exist. This is caused by get_available_options method calling composer help without setting the working-dir option.

This is what is executed by ansible:

$ composer help symfony:dump-env

                                                                  
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  There are no commands defined in the "symfony" namespace.       
                                                                  

help [--xml] [--format FORMAT] [--raw] [--] [<command_name>]

This should be executed instead:

$ composer help symfony:dump-env --working-dir /path/to/my/working/dir
Usage:
  symfony:dump-env [options] [--] [<env>]
  dump-env

Arguments:
  env                            The application environment to dump .env files for - e.g. "prod".

Options:
      --empty                    Ignore the content of .env files
  -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:
  Compiles .env files to .env.local.php.

Issue Type

Bug Report

Component Name

composer

Ansible Version

$ ansible --version
ansible [core 2.11.6] 
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = ~/.pyenv/versions/3.9.7/envs/ansible-venv-3.9.7/lib/python3.9/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = ~/.pyenv/versions/ansible-venv-3.9.7/bin/ansible
  python version = 3.9.7 (default, Nov  5 2021, 08:41:26) [GCC 4.8.5]
  jinja version = 3.0.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# ~/.pyenv/versions/3.9.7/envs/ansible-venv-3.9.7/lib/python3.9/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 3.8.1  

Configuration

$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False

OS / Environment

Target OS is SLES 15-SP3, but that should not be of concern. I installed composer using the ansible role by geerlingguy

Steps to Reproduce

- name: Setup env file with composer/symfony flex
  composer:
    command: symfony:dump-env
    arguments: prod
    working_dir: "{{ project_checkout_path }}"

Expected Results

I expected the command to be executed properly.

Actual Results

fatal: [project]: FAILED! => {"changed": false, "msg": "[Symfony\\Component\\Console\\Exception\\CommandNotFoundException] There are no commands defined in the \"symfony\" namespace. help [--xml] [--format FORMAT] [--raw] [--] [<command_name>]"}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @dmtrs
click here for bot help

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@strarsis
Copy link

+1, I have to use the ansible command or shell module instead because of this issue.

@felixfontein
Copy link
Collaborator

Both this issue and #5204 seem to be waiting for someone to pick them up.

@felixfontein felixfontein added the waiting_on_contributor Needs help. Feel free to engage to get things unblocked label Jan 25, 2023
@lyrixx
Copy link

lyrixx commented Oct 18, 2023

Hey folks, can you test #7405 and tell us if it fix the issue? Thanks

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 has_pr language module module packaging plugins plugin (any type) waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants