Merge pull request #850 from andskli/cpanm-addopt-installdeps
cpanm: add installdeps option
This commit is contained in:
commit
5cd0a28f9f
1 changed files with 16 additions and 3 deletions
|
@ -58,6 +58,12 @@ options:
|
||||||
- Use the mirror's index file instead of the CPAN Meta DB
|
- Use the mirror's index file instead of the CPAN Meta DB
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
installdeps:
|
||||||
|
description:
|
||||||
|
- Only install dependencies
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
version_added: "2.0"
|
||||||
notes:
|
notes:
|
||||||
- Please note that U(http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm) must be installed on the remote host.
|
- Please note that U(http://search.cpan.org/dist/App-cpanminus/bin/cpanm, cpanm) must be installed on the remote host.
|
||||||
author: "Franck Cuny (@franckcuny)"
|
author: "Franck Cuny (@franckcuny)"
|
||||||
|
@ -94,7 +100,8 @@ def _is_package_installed(module, name, locallib, cpanm):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpanm):
|
def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only,
|
||||||
|
installdeps, cpanm):
|
||||||
# this code should use "%s" like everything else and just return early but not fixing all of it now.
|
# this code should use "%s" like everything else and just return early but not fixing all of it now.
|
||||||
# don't copy stuff like this
|
# don't copy stuff like this
|
||||||
if from_path:
|
if from_path:
|
||||||
|
@ -114,6 +121,9 @@ def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpan
|
||||||
if mirror_only is True:
|
if mirror_only is True:
|
||||||
cmd = "{cmd} --mirror-only".format(cmd=cmd)
|
cmd = "{cmd} --mirror-only".format(cmd=cmd)
|
||||||
|
|
||||||
|
if installdeps is True:
|
||||||
|
cmd = "{cmd} --installdeps".format(cmd=cmd)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,6 +135,7 @@ def main():
|
||||||
locallib=dict(default=None, required=False),
|
locallib=dict(default=None, required=False),
|
||||||
mirror=dict(default=None, required=False),
|
mirror=dict(default=None, required=False),
|
||||||
mirror_only=dict(default=False, type='bool'),
|
mirror_only=dict(default=False, type='bool'),
|
||||||
|
installdeps=dict(default=False, type='bool'),
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -139,6 +150,7 @@ def main():
|
||||||
locallib = module.params['locallib']
|
locallib = module.params['locallib']
|
||||||
mirror = module.params['mirror']
|
mirror = module.params['mirror']
|
||||||
mirror_only = module.params['mirror_only']
|
mirror_only = module.params['mirror_only']
|
||||||
|
installdeps = module.params['installdeps']
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
@ -146,7 +158,8 @@ def main():
|
||||||
|
|
||||||
if not installed:
|
if not installed:
|
||||||
out_cpanm = err_cpanm = ''
|
out_cpanm = err_cpanm = ''
|
||||||
cmd = _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, cpanm)
|
cmd = _build_cmd_line(name, from_path, notest, locallib, mirror,
|
||||||
|
mirror_only, installdeps, cpanm)
|
||||||
|
|
||||||
rc_cpanm, out_cpanm, err_cpanm = module.run_command(cmd, check_rc=False)
|
rc_cpanm, out_cpanm, err_cpanm = module.run_command(cmd, check_rc=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue