From b02eb232b0d0cace1ba1bd2dc9fb7ecf71ba4bf7 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Sun, 31 Jan 2016 01:32:09 -0800 Subject: [PATCH] Show error if python-apt is absent in check mode. Previously this would fail with an exception which did not clearly explain the reason for the failure. --- lib/ansible/modules/packaging/os/apt_repository.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/packaging/os/apt_repository.py b/lib/ansible/modules/packaging/os/apt_repository.py index 52208f25987..6cf5014c2fa 100644 --- a/lib/ansible/modules/packaging/os/apt_repository.py +++ b/lib/ansible/modules/packaging/os/apt_repository.py @@ -129,6 +129,8 @@ def install_python_apt(module): HAVE_PYTHON_APT = True else: module.fail_json(msg="Failed to auto-install python-apt. Error was: '%s'" % se.strip()) + else: + module.fail_json(msg="python-apt must be installed to use check mode") class InvalidSource(Exception): pass