1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-28 15:09:15 +00:00

composer: restore compatibility with older composer versions (#12339)

* Restore compatibility.

* Adjust tests.
This commit is contained in:
Felix Fontein 2026-06-25 05:33:40 +02:00 committed by GitHub
parent 77e1e047b8
commit 2354b40d10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 8 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "composer - restore compatibility with older compose versions when using ``working_dir`` (https://github.com/ansible-collections/community.general/issues/12293, https://github.com/ansible-collections/community.general/pull/12339)."

View file

@ -189,7 +189,7 @@ def composer_command(module, command, arguments=None, options=None):
working_dir_option = []
else:
global_arg = []
working_dir_option = ["--working-dir", module.params["working_dir"]]
working_dir_option = [f"--working-dir={module.params['working_dir']}"]
if module.params["executable"] is None:
php_path = module.get_bin_path("php", True, ["/usr/local/bin"])

View file

@ -5,24 +5,24 @@
---
anchors:
help_install: &help_install
command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "help", "install", "--no-interaction", "--format=json"]
command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "help", "install", "--no-interaction", "--format=json"]
rc: 0
out: |
{"definition": {"options": ["a", "b", "c"]}}
err: ''
help_create_project: &help_create_project
command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "help", "create-project", "--no-interaction", "--format=json"]
command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "help", "create-project", "--no-interaction", "--format=json"]
rc: 0
out: |
{"definition": {"options": ["a", "b", "c"]}}
err: ''
run_create_project: &run_create_project
command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "create-project", "vendor/package"]
command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "create-project", "vendor/package"]
rc: 0
out: ''
err: ''
help_config: &help_config
command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "help", "config", "--no-interaction", "--format=json"]
command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "help", "config", "--no-interaction", "--format=json"]
rc: 0
out: |
{"definition": {"options": ["a", "b", "c"]}}
@ -38,7 +38,7 @@ test_cases:
mocks:
run_command:
- *help_install
- command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "install"]
- command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "install"]
rc: 0
out: ''
err: ''
@ -99,7 +99,7 @@ test_cases:
return_values: ["hash1", "hash2", "hash1", "hash2"]
run_command:
- *help_config
- command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "config", "setting-key", "setting-value"]
- command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "config", "setting-key", "setting-value"]
rc: 0
out: ''
err: ''
@ -118,7 +118,7 @@ test_cases:
return_values: ["hash1", "hash2", "hash1_changed", "hash2"]
run_command:
- *help_config
- command: ["/testbin/php", "/testbin/composer", "--working-dir", "/var/www/foo", "config", "setting-key", "setting-value"]
- command: ["/testbin/php", "/testbin/composer", "--working-dir=/var/www/foo", "config", "setting-key", "setting-value"]
rc: 0
out: ''
err: ''