|
|
|
@ -72,14 +72,17 @@ author: Franck Cuny
|
|
|
|
|
def _is_package_installed(module, name, locallib, cpanm):
|
|
|
|
|
cmd = ""
|
|
|
|
|
if locallib:
|
|
|
|
|
cmd = "PERL5LIB={locallib}/lib/perl5".format(locallib=locallib)
|
|
|
|
|
cmd = "{cmd} perl -M{name} -e '1'".format(cmd=cmd, name=name)
|
|
|
|
|
os.environ["PERL5LIB"] = "%s/lib/perl5" % locallib
|
|
|
|
|
cmd = "%s perl -M%s -e '1'" % (cmd, name)
|
|
|
|
|
res, stdout, stderr = module.run_command(cmd, check_rc=False)
|
|
|
|
|
installed = True if res == 0 else False
|
|
|
|
|
return installed
|
|
|
|
|
|
|
|
|
|
if res == 0
|
|
|
|
|
return True
|
|
|
|
|
else
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def _build_cmd_line(name, from_path, notest, locallib, mirror, cpanm):
|
|
|
|
|
# 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
|
|
|
|
|
if from_path:
|
|
|
|
|
cmd = "{cpanm} {path}".format(cpanm=cpanm, path=from_path)
|
|
|
|
|
else:
|
|
|
|
@ -112,7 +115,6 @@ def main():
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
cpanm = module.get_bin_path('cpanm', True)
|
|
|
|
|
|
|
|
|
|
name = module.params['name']
|
|
|
|
|
from_path = module.params['from_path']
|
|
|
|
|
notest = module.boolean(module.params.get('notest', False))
|
|
|
|
@ -137,7 +139,6 @@ def main():
|
|
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, binary=cpanm, name=name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# import module snippets
|
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
|
|
|
|
|
|