mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
composer: return skipped if command has no --dry-run (#32010)
This commit is contained in:
parent
74bd13727a
commit
e7d7a29a46
1 changed files with 18 additions and 31 deletions
|
@ -31,89 +31,74 @@ options:
|
||||||
version_added: "1.8"
|
version_added: "1.8"
|
||||||
description:
|
description:
|
||||||
- Composer command like "install", "update" and so on.
|
- Composer command like "install", "update" and so on.
|
||||||
required: false
|
|
||||||
default: install
|
default: install
|
||||||
arguments:
|
arguments:
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
description:
|
description:
|
||||||
- Composer arguments like required package, version and so on.
|
- Composer arguments like required package, version and so on.
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
executable:
|
executable:
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
description:
|
description:
|
||||||
- Path to PHP Executable on the remote host, if PHP is not in PATH
|
- Path to PHP Executable on the remote host, if PHP is not in PATH.
|
||||||
required: false
|
aliases: [ php_path ]
|
||||||
default: null
|
|
||||||
aliases: [ "php_path" ]
|
|
||||||
working_dir:
|
working_dir:
|
||||||
description:
|
description:
|
||||||
- Directory of your project (see --working-dir). This is required when
|
- Directory of your project (see --working-dir). This is required when
|
||||||
the command is not run globally.
|
the command is not run globally.
|
||||||
- Will be ignored if C(global_command=true).
|
- Will be ignored if C(global_command=true).
|
||||||
required: false
|
aliases: [ working-dir ]
|
||||||
default: null
|
|
||||||
aliases: [ "working-dir" ]
|
|
||||||
global_command:
|
global_command:
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
description:
|
description:
|
||||||
- Runs the specified command globally.
|
- Runs the specified command globally.
|
||||||
required: false
|
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
default: false
|
default: false
|
||||||
aliases: [ "global-command" ]
|
aliases: [ global-command ]
|
||||||
prefer_source:
|
prefer_source:
|
||||||
description:
|
description:
|
||||||
- Forces installation from package sources when possible (see --prefer-source).
|
- Forces installation from package sources when possible (see --prefer-source).
|
||||||
required: false
|
|
||||||
default: false
|
default: false
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "prefer-source" ]
|
aliases: [ prefer-source ]
|
||||||
prefer_dist:
|
prefer_dist:
|
||||||
description:
|
description:
|
||||||
- Forces installation from package dist even for dev versions (see --prefer-dist).
|
- Forces installation from package dist even for dev versions (see --prefer-dist).
|
||||||
required: false
|
|
||||||
default: false
|
default: false
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "prefer-dist" ]
|
aliases: [ prefer-dist ]
|
||||||
no_dev:
|
no_dev:
|
||||||
description:
|
description:
|
||||||
- Disables installation of require-dev packages (see --no-dev).
|
- Disables installation of require-dev packages (see --no-dev).
|
||||||
required: false
|
|
||||||
default: true
|
default: true
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "no-dev" ]
|
aliases: [ no-dev ]
|
||||||
no_scripts:
|
no_scripts:
|
||||||
description:
|
description:
|
||||||
- Skips the execution of all scripts defined in composer.json (see --no-scripts).
|
- Skips the execution of all scripts defined in composer.json (see --no-scripts).
|
||||||
required: false
|
|
||||||
default: false
|
default: false
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "no-scripts" ]
|
aliases: [ no-scripts ]
|
||||||
no_plugins:
|
no_plugins:
|
||||||
description:
|
description:
|
||||||
- Disables all plugins ( see --no-plugins ).
|
- Disables all plugins ( see --no-plugins ).
|
||||||
required: false
|
|
||||||
default: false
|
default: false
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "no-plugins" ]
|
aliases: [ no-plugin ]
|
||||||
optimize_autoloader:
|
optimize_autoloader:
|
||||||
description:
|
description:
|
||||||
- Optimize autoloader during autoloader dump (see --optimize-autoloader).
|
- Optimize autoloader during autoloader dump (see --optimize-autoloader).
|
||||||
- Convert PSR-0/4 autoloading to classmap to get a faster autoloader.
|
- Convert PSR-0/4 autoloading to classmap to get a faster autoloader.
|
||||||
- Recommended especially for production, but can take a bit of time to run.
|
- Recommended especially for production, but can take a bit of time to run.
|
||||||
required: false
|
|
||||||
default: true
|
default: true
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "optimize-autoloader" ]
|
aliases: [ optimize-autoloader ]
|
||||||
ignore_platform_reqs:
|
ignore_platform_reqs:
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
description:
|
description:
|
||||||
- Ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these.
|
- Ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these.
|
||||||
required: false
|
|
||||||
default: false
|
default: false
|
||||||
choices: [ true, false]
|
choices: [ true, false]
|
||||||
aliases: [ "ignore-platform-reqs" ]
|
aliases: [ ignore-platform-reqs ]
|
||||||
requirements:
|
requirements:
|
||||||
- php
|
- php
|
||||||
- composer installed in bin path (recommended /usr/local/bin)
|
- composer installed in bin path (recommended /usr/local/bin)
|
||||||
|
@ -148,7 +133,6 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,9 +172,9 @@ def composer_command(module, command, arguments="", options=None, global_command
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
command=dict(default="install", type="str", required=False),
|
command=dict(default="install", type="str"),
|
||||||
arguments=dict(default="", type="str", required=False),
|
arguments=dict(default="", type="str"),
|
||||||
executable=dict(type="path", required=False, aliases=["php_path"]),
|
executable=dict(type="path", aliases=["php_path"]),
|
||||||
working_dir=dict(type="path", aliases=["working-dir"]),
|
working_dir=dict(type="path", aliases=["working-dir"]),
|
||||||
global_command=dict(default=False, type="bool", aliases=["global-command"]),
|
global_command=dict(default=False, type="bool", aliases=["global-command"]),
|
||||||
prefer_source=dict(default=False, type="bool", aliases=["prefer-source"]),
|
prefer_source=dict(default=False, type="bool", aliases=["prefer-source"]),
|
||||||
|
@ -247,7 +231,10 @@ def main():
|
||||||
options.append(option)
|
options.append(option)
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
|
if 'dry-run' in available_options:
|
||||||
options.append('--dry-run')
|
options.append('--dry-run')
|
||||||
|
else:
|
||||||
|
module.exit_json(skipped=True, msg="command '%s' does not support check mode, skipping" % command)
|
||||||
|
|
||||||
rc, out, err = composer_command(module, command, arguments, options, global_command)
|
rc, out, err = composer_command(module, command, arguments, options, global_command)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue