mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Clean options building in Composer module
This commit is contained in:
parent
9fd9f3766e
commit
97ed348e17
1 changed files with 21 additions and 17 deletions
|
@ -128,30 +128,34 @@ def main():
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
module.params["working_dir"] = os.path.abspath(module.params["working_dir"])
|
options = []
|
||||||
|
|
||||||
options = set([])
|
|
||||||
# Default options
|
# Default options
|
||||||
options.add("--no-ansi")
|
options.append('--no-ansi')
|
||||||
options.add("--no-progress")
|
options.append('--no-progress')
|
||||||
options.add("--no-interaction")
|
options.append('--no-interaction')
|
||||||
|
|
||||||
if module.check_mode:
|
options.extend(['--working-dir', os.path.abspath(module.params['working_dir'])])
|
||||||
options.add("--dry-run")
|
|
||||||
del module.params['CHECKMODE']
|
|
||||||
|
|
||||||
# Get composer command with fallback to default
|
# Get composer command with fallback to default
|
||||||
command = module.params['command']
|
command = module.params['command']
|
||||||
del module.params['command'];
|
|
||||||
|
|
||||||
# Prepare options
|
# Prepare options
|
||||||
for i in module.params:
|
if module.params['prefer_source']:
|
||||||
opt = "--%s" % i.replace("_","-")
|
options.append('--prefer-source')
|
||||||
p = module.params[i]
|
if module.params['prefer_dist']:
|
||||||
if isinstance(p, (bool)) and p:
|
options.append('--prefer-dist')
|
||||||
options.add(opt)
|
if module.params['no_dev']:
|
||||||
elif isinstance(p, (str)):
|
options.append('--no-dev')
|
||||||
options.add("%s=%s" % (opt, p))
|
if module.params['no_scripts']:
|
||||||
|
options.append('--no-scripts')
|
||||||
|
if module.params['no_plugins']:
|
||||||
|
options.append('--no-plugins')
|
||||||
|
if module.params['optimize_autoloader']:
|
||||||
|
options.append('--optimize-autoloader')
|
||||||
|
|
||||||
|
if module.check_mode:
|
||||||
|
options.append('--dry-run')
|
||||||
|
|
||||||
rc, out, err = composer_install(module, command, options)
|
rc, out, err = composer_install(module, command, options)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue