From bc912581242afcb42987714785154b13defcd07e Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 20 Dec 2017 10:09:15 +0530 Subject: [PATCH] apt_get: add warning for force_apt_get (#33994) This fix adds strict check for package manager binary checking in given path. Fixes: #32940 Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/packaging/os/apt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 79b8399cf24..0e8070dddef 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -753,6 +753,12 @@ def upgrade(m, mode="yes", force=False, default_release=None, else: force_yes = '' + if apt_cmd is None: + if use_apt_get: + apt_cmd = APT_GET_CMD + else: + m.fail_json(msg="Unable to find APTITUDE in path. Please make sure " + "to have APTITUDE in path or use 'force_apt_get=True'") apt_cmd_path = m.get_bin_path(apt_cmd, required=True) cmd = '%s -y %s %s %s %s' % (apt_cmd_path, dpkg_options,