From 6a77e62df476d35a850081b48ab2ec5336b0afae Mon Sep 17 00:00:00 2001 From: stoned Date: Tue, 12 Apr 2016 07:21:28 +0200 Subject: [PATCH] =?UTF-8?q?cpanm:=20search=20both=20its=20stderr=20and=20i?= =?UTF-8?q?ts=20stdout=20for=20the=20message=20'is=20up=20t=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that since cpanm version 1.6926 its messages are sent to stdout when previously they were sent to stderr. Also there is no need to initialize out_cpanm and err_cpanm and check for their truthiness as module.run_command() and str.find() take care of that. --- lib/ansible/modules/extras/packaging/language/cpanm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/packaging/language/cpanm.py b/lib/ansible/modules/extras/packaging/language/cpanm.py index 919677466ab..769ea5f02fa 100644 --- a/lib/ansible/modules/extras/packaging/language/cpanm.py +++ b/lib/ansible/modules/extras/packaging/language/cpanm.py @@ -202,7 +202,6 @@ def main(): installed = _is_package_installed(module, name, locallib, cpanm, version) if not installed: - out_cpanm = err_cpanm = '' cmd = _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, installdeps, cpanm, use_sudo) rc_cpanm, out_cpanm, err_cpanm = module.run_command(cmd, check_rc=False) @@ -210,7 +209,7 @@ def main(): if rc_cpanm != 0: module.fail_json(msg=err_cpanm, cmd=cmd) - if err_cpanm and 'is up to date' not in err_cpanm: + if (err_cpanm.find('is up to date') == -1 and out_cpanm.find('is up to date') == -1): changed = True module.exit_json(changed=changed, binary=cpanm, name=name)